-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #71 from Clinical-Genomics/container
Docker file (minor) ### Added - Docker file - commit template - dockerhub push to stage - on pulrequest - dockerhub push to prod - on new release - bump version - on merge to master - updating test coverage - on merge to master - dockerhub push to stage - on merge to master
- Loading branch information
Showing
7 changed files
with
216 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
|
||
### Added | ||
- | ||
|
||
### Changed | ||
- | ||
|
||
### Fixed | ||
- |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
|
||
name: Push cg_lims image to Docker Hub on push event | ||
|
||
on: [pull_request] | ||
|
||
jobs: | ||
docker-image-push: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out git repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Extract branch name and remove illegal chars | ||
id: get_branch_name | ||
shell: bash | ||
run: echo "##[set-output name=branch;]$(echo "$(tr "/" "-" <<<${GITHUB_REF#refs/heads/})")" | ||
|
||
- name: Login to Docker Hub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
- name: Set up Docker Buildx | ||
id: buildx | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- name: Build and push | ||
id: docker_build | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: ./ | ||
file: ./Dockerfile | ||
push: true | ||
tags: "clinicalgenomics/cg_lims-stage:${{steps.get_branch_name.outputs.branch}}, clinicalgenomics/cg_lims-stage:latest" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
|
||
name: Push to Docker Hub on new release event | ||
|
||
on: | ||
release: | ||
types: | ||
- created | ||
|
||
jobs: | ||
docker-image-release_push: | ||
# Push to Docker Hub when a new release is created | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- name: Check Out Repo | ||
uses: actions/checkout@v2 | ||
|
||
- name: Login to Docker Hub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
- name: Set up Docker Buildx | ||
id: buildx | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- name: Build and push | ||
id: docker_build | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: ./ | ||
file: ./Dockerfile | ||
push: true | ||
tags: "clinicalgenomics/cg_lims:${{github.event.release.tag_name}}, clinicalgenomics/cg_lims:latest" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
name: 'Merge-master-CI' | ||
on: | ||
push: | ||
branches: | ||
- 'master' | ||
- 'main' | ||
|
||
jobs: | ||
bump-version: | ||
runs-on: ubuntu-latest | ||
name: Bump version and push tags to master | ||
steps: | ||
- name: Bump version | ||
uses: Clinical-Genomics/bump2version-ci@master | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
GITHUB_REPOSITORY: ${{ github.repository }} | ||
GITHUB_ACTOR: ${{ github.actor }} | ||
with: | ||
release_pat: ${{ secrets.BUMPVERSION_TOKEN }} | ||
|
||
docker-image-push: | ||
runs-on: ubuntu-latest | ||
name: Push staging docker image to dockerhub | ||
steps: | ||
- name: Check out git repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Extract branch name and remove illegal chars | ||
id: get_branch_name | ||
shell: bash | ||
run: echo "##[set-output name=branch;]$(echo "$(tr "/" "-" <<<${GITHUB_REF#refs/heads/})")" | ||
|
||
- name: Login to Docker Hub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
- name: Set up Docker Buildx | ||
id: buildx | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- name: Build and push | ||
id: docker_build | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: ./ | ||
file: ./Dockerfile | ||
push: true | ||
tags: "clinicalgenomics/cg_lims-stage:${{steps.get_branch_name.outputs.branch}}, clinicalgenomics/cg_lims-stage:latest" | ||
|
||
tests-coverage: | ||
runs-on: ubuntu-latest | ||
name: Test and coveralls | ||
steps: | ||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.8 | ||
|
||
- name: Check out limsmock | ||
uses: actions/checkout@v2 | ||
with: | ||
repository: "Clinical-Genomics/limsmock" | ||
|
||
- name: Install limsmock dependencies | ||
run: | | ||
python -m pip install --upgrade pip==21.1.2 | ||
pip install -r requirements.txt -r requirements-dev.txt . | ||
- name: Check out cg_lims | ||
uses: actions/checkout@v2 | ||
with: | ||
repository: "Clinical-Genomics/cg_lims" | ||
|
||
- name: Install cg_lims dependencies | ||
run: | | ||
pip install -r requirements.txt -r requirements-dev.txt . | ||
- name: Install coveralls dependencies | ||
run: | | ||
pip install pytest-cov coveralls | ||
- name: Test with pytest & Coveralls | ||
run: | | ||
pytest --cov=cg_lims/ | ||
coveralls | ||
env: | ||
GITHUB: 1 | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
FROM python:3.8-slim | ||
|
||
LABEL base_image="python:3.8-slim" | ||
LABEL about.home="https://github.com/Clinical-Genomics/cg_lims" | ||
LABEL about.tags="NIPT,statistics,Non Invasive Prenatal Test,python" | ||
|
||
|
||
ENV GUNICORN_WORKERS=1 | ||
ENV GUNICORN_THREADS=1 | ||
ENV GUNICORN_BIND="0.0.0.0:8000" | ||
ENV GUNICORN_TIMEOUT=400 | ||
ENV BASEURI="https://clinical-lims-stage.scilifelab.se" | ||
ENV HOST="clinical-lims-stage.scilifelab.se" | ||
ENV USERNAME="apiuser" | ||
ENV PASSWORD="??" | ||
ENV CG_URL="https://clinical-api.scilifelab.se/api/v1" | ||
ENV CG_LIMS_HOST="localhost" | ||
ENV CG_LIMS_PORT=8000 | ||
|
||
EXPOSE 8000 | ||
|
||
WORKDIR /home/worker/app | ||
COPY . /home/worker/app | ||
|
||
# Install app requirements | ||
RUN pip install -r requirements.txt | ||
|
||
# Install app | ||
RUN pip install -e . | ||
|
||
CMD gunicorn \ | ||
--workers=$GUNICORN_WORKERS \ | ||
--bind=$GUNICORN_BIND \ | ||
--threads=$GUNICORN_THREADS \ | ||
--timeout=$GUNICORN_TIMEOUT \ | ||
--proxy-protocol \ | ||
--forwarded-allow-ips="10.0.2.100,127.0.0.1" \ | ||
--log-syslog \ | ||
--access-logfile - \ | ||
--log-level="debug" \ | ||
--worker-class=uvicorn.workers.UvicornWorker \ | ||
cg_lims.app.api.api_v1.api:app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,6 @@ click | |
PyYAML | ||
pydantic | ||
fastapi | ||
pandas | ||
pandas | ||
gunicorn | ||
uvicorn |