-
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.
Added docker related files to build container for hdf5-reader-service
- Loading branch information
Showing
4 changed files
with
164 additions
and
0 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,3 @@ | ||
**/.* | ||
**/*.pyc | ||
**/*.swp |
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,85 @@ | ||
name: Container CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
build-image: | ||
timeout-minutes: 60 | ||
|
||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Generate image tags | ||
id: tagger | ||
run: | | ||
# tag is branch name or tag if there is a tag | ||
echo ::set-output name=image_tag::${GITHUB_REF##*/} | ||
echo ::set-output name=do_push::true | ||
- name: Cache Docker layers | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/cache | ||
!~/cache/exclude | ||
key: ${{ runner.os }}-hdf5-reader-service-${{ github.sha }} | ||
restore-keys: ${{ runner.os }}-hdf5-reader-service- | ||
|
||
- name: Log in to Github Docker Registry | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ghcr.io/hdf5-reader-service | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Set up Docker Buildx | ||
id: buildx | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- name: Multi-stage build for test container | ||
uses: docker/build-push-action@v2 | ||
with: | ||
builder: ${{ steps.buildx.output.name }} | ||
push: false | ||
tags: user/hdf5-reader-service:test | ||
target: runtime | ||
load: true | ||
cache-from: type=local,src=~/cache | ||
cache-to: type=local,dest=~/cache | ||
|
||
- name: Run test container | ||
run: | | ||
docker run --rm user/hdf5-reader-service:test | ||
- name: Run multi-stage build (runtime container) | ||
uses: docker/build-push-action@v2 | ||
with: | ||
builder: ${{ steps.buildx.output.name }} | ||
push: true | ||
tags: | | ||
ghcr.io/${{ github.repository }}:${{ steps.tagger.outputs.image_tag }} | ||
target: runtime | ||
cache-from: type=local,src=~/cache | ||
cache-to: type=local,dest=~/cache | ||
|
||
- name: Run multi-stage build (developer container) | ||
uses: docker/build-push-action@v2 | ||
with: | ||
builder: ${{ steps.buildx.output.name }} | ||
push: true | ||
tags: | | ||
ghcr.io/${{ github.repository }}:${{ steps.tagger.outputs.image_tag }}.dev | ||
target: developer | ||
cache-from: type=local,src=~/cache | ||
cache-to: type=local,dest=~/cache |
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,24 @@ | ||
##### Shared Environment stage ######################################################### | ||
FROM registry.hub.docker.com/library/python:3.9-slim AS base | ||
|
||
ENV PIP_DEPENDENCIES wheel pip | ||
ENV ENV_DIR /webapp | ||
|
||
ENV VIRTUAL_ENV=/opt/venv | ||
RUN python3 -m venv $VIRTUAL_ENV | ||
ENV PATH="$VIRTUAL_ENV/bin:$PATH" | ||
|
||
# Install pip dependencies | ||
COPY requirements.txt . | ||
RUN python3.9 -m pip install --upgrade pip | ||
RUN python3.9 -m pip install -r requirements.txt | ||
|
||
# Copy hdf5-reader-service code into container | ||
COPY . ${ENV_DIR} | ||
|
||
ENV ENV_DIR /webapp | ||
WORKDIR ${ENV_DIR} | ||
|
||
ENV PYTHON_SITE_PACKAGES /usr/local/lib/python3.9/site-packages | ||
|
||
CMD ["uvicorn", "webapp.main:app", "--host", "127.0.0.1", "--port", "8001"] |
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,52 @@ | ||
anyio==3.5.0 | ||
asgiref==3.4.1 | ||
attrs==21.4.0 | ||
black==22.1.0 | ||
cached-property==1.5.2 | ||
certifi==2021.10.8 | ||
charset-normalizer==2.0.12 | ||
click==8.0.3 | ||
contextlib2==21.6.0 | ||
contextvars==2.4 | ||
defusedxml==0.7.1 | ||
fastapi==0.74.1 | ||
flake8==4.0.1 | ||
h11==0.13.0 | ||
h5py==3.1.0 | ||
httpie==2.6.0 | ||
idna==3.3 | ||
immutables==0.16 | ||
importlib-metadata==4.2.0 | ||
iniconfig==1.1.1 | ||
itsdangerous==2.0.1 | ||
Jinja2==3.0.3 | ||
MarkupSafe==2.0.1 | ||
mccabe==0.6.1 | ||
mypy==0.931 | ||
mypy-extensions==0.4.3 | ||
numpy==1.19.5 | ||
orjson==3.6.1 | ||
packaging==21.3 | ||
pathspec==0.9.0 | ||
platformdirs==2.4.0 | ||
pluggy==1.0.0 | ||
py==1.11.0 | ||
pycodestyle==2.8.0 | ||
pydantic==1.9.0 | ||
pyflakes==2.4.0 | ||
Pygments==2.11.2 | ||
pyparsing==3.0.7 | ||
PySocks==1.7.1 | ||
pytest==7.0.1 | ||
requests==2.27.1 | ||
requests-toolbelt==0.9.1 | ||
sniffio==1.2.0 | ||
starlette==0.17.1 | ||
termcolor==1.1.0 | ||
tomli==1.2.3 | ||
typed-ast==1.5.2 | ||
typing_extensions==4.1.1 | ||
urllib3==1.26.8 | ||
uvicorn==0.16.0 | ||
Werkzeug==2.0.3 | ||
zipp==3.6.0 |