Skip to content

Commit

Permalink
Updates Dockerfiles to use local package install instead of pypi.
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert Chu committed Apr 21, 2021
1 parent 845e4dd commit 3821d1d
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 42 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ jobs:
password: ${{ secrets.PYPI_API_TOKEN }}

publish-docker:
needs: publish-pypi
if: startsWith(github.ref, 'refs/tags')
name: Publish script-runner to dockerhub
runs-on: ubuntu-latest
Expand Down Expand Up @@ -119,7 +118,7 @@ jobs:
- name: Push to Docker Hub
uses: docker/build-push-action@v2
with:
context: ./docker
context: ./
file: ./docker/Dockerfile
builder: ${{ steps.buildx.outputs.name }}
push: ${{ github.event_name != 'pull_request' }}
Expand All @@ -135,7 +134,6 @@ jobs:
PYTHON_IMAGE_TAG=${{ steps.prep.outputs.pyversion }}
publish-docker-example:
needs: publish-pypi
if: startsWith(github.ref, 'refs/tags')
name: Publish script-runner-example to dockerhub
runs-on: ubuntu-latest
Expand Down Expand Up @@ -181,7 +179,7 @@ jobs:
- name: Push to Docker Hub
uses: docker/build-push-action@v2
with:
context: ./docker
context: ./
file: ./docker/Dockerfile.example
builder: ${{ steps.buildx.outputs.name }}
push: ${{ github.event_name != 'pull_request' }}
Expand Down
File renamed without changes.
8 changes: 4 additions & 4 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ services:
server:
image: labflow/script-runner-example:latest
build:
dockerfile: ./Dockerfile.example
context: ./docker
dockerfile: ./docker/Dockerfile.example
context: ./
args:
SERVER_VERSION: local+devcontainer
command: "python3 -m flask run --host=0.0.0.0 --port=5000"
Expand All @@ -23,8 +23,8 @@ services:
worker:
image: labflow/script-runner-example:latest
build:
dockerfile: ./Dockerfile.example
context: ./docker
dockerfile: ./docker/Dockerfile.example
context: ./
args:
SERVER_VERSION: local+devcontainer
command: "python3 -m celery -A script_runner.analysis worker"
Expand Down
14 changes: 4 additions & 10 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,12 @@ ARG PYTHON_IMAGE_TAG=alpine

FROM python:${PYTHON_IMAGE_TAG}

ARG SCRIPT_RUNNER_VERSION=local+container

WORKDIR /app

RUN pip install \
script-runner-api==${SCRIPT_RUNNER_VERSION}

COPY ./entrypoint.sh /entrypoint.sh
RUN dos2unix /entrypoint.sh
RUN chmod +x /entrypoint.sh
COPY . /script-runner
RUN pip install /script-runner
RUN rm -rf /script-runner

ENV FLASK_APP=script_runner.main:app
ENV SERVER_VERSION=$SERVER_VERSION

ENTRYPOINT [ "/entrypoint.sh" ]
CMD "python3 -m gunicorn.app.wsgiapp --timeout 240 --bind 0.0.0.0:${PORT} --access-logfile - --error-logfile - --workers 4 ${FLASK_APP}"
15 changes: 7 additions & 8 deletions docker/Dockerfile.example
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
FROM rocker/verse:3.6.3

ARG SERVER_VERSION=local+container
ARG SCRIPT_RUNNER_VERSION=local+container

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Install extra *nix utils
Expand Down Expand Up @@ -63,13 +62,13 @@ RUN git clone git://github.com/lab-grid/swabseq-analysis /app
# Python Env
WORKDIR /app

RUN pip3 install \
pandas \
script-runner-api==${SCRIPT_RUNNER_VERSION}
RUN pip3 install pandas

COPY ./entrypoint.sh /entrypoint.sh
RUN dos2unix /entrypoint.sh
RUN chmod +x /entrypoint.sh
COPY . /script-runner
RUN pip3 install /script-runner
RUN rm -rf /script-runner

COPY ./config.json /app/config.json

RUN mkdir /base-rundir
RUN wget -qO- https://swabseq-analysis-examples.s3-us-west-1.amazonaws.com/bcls/H3FY3K.tar.gz \
Expand All @@ -79,4 +78,4 @@ ENV PYTHONPATH="${RBASE}:${PYTHONPATH}"
ENV FLASK_APP=script_runner.main:app
ENV SERVER_VERSION=$SERVER_VERSION

ENTRYPOINT [ "/entrypoint.sh" ]
CMD "python3 -m gunicorn.app.wsgiapp --timeout 240 --bind 0.0.0.0:${PORT} --access-logfile - --error-logfile - --workers 4 ${FLASK_APP}"
13 changes: 0 additions & 13 deletions docker/entrypoint.sh

This file was deleted.

14 changes: 14 additions & 0 deletions example.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
SERVER_NAME=localhost:5000

REDIS_PASSWORD=my-redis-password

AUTH_PROVIDER=none
AUTH0_DOMAIN=
AUTH0_CLIENT_ID=

AUTH0_API_AUTHORITY=
AUTH0_API_AUDIENCE=

AUTH0_AUTHORIZATION_URL=
AUTH0_TOKEN_URL=

6 changes: 3 additions & 3 deletions terraform/aws/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ terraform {
# IAM -------------------------------------------------------------------------

resource "aws_iam_role" "labflow_role" {
name = "${input.stack_name}-role"
name = "${var.stack_name}-role"

# May be necessary: https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role
# force_detach_policies = true
Expand Down Expand Up @@ -47,7 +47,7 @@ EOF
module "vpc" {
source = "terraform-aws-modules/vpc/aws"

name = "${input.stack_name}-vpc"
name = "${var.stack_name}-vpc"

enable_nat_gateway = true
enable_dns_hostnames = true
Expand All @@ -61,7 +61,7 @@ module "vpc" {
module "ecs" {
source = "terraform-aws-modules/ecs/aws"

name = "${input.stack_name}-ecs"
name = "${var.stack_name}-ecs"

container_insights = true

Expand Down

0 comments on commit 3821d1d

Please sign in to comment.