Add Dockerfile
This commit is contained in:
parent
ca57a23f9d
commit
79c3913e28
2 changed files with 20 additions and 10 deletions
19
.github/workflows/flaskr-ci.yaml
vendored
19
.github/workflows/flaskr-ci.yaml
vendored
|
|
@ -42,7 +42,8 @@ jobs:
|
||||||
- name: Job vars and prep
|
- name: Job vars and prep
|
||||||
id: vars
|
id: vars
|
||||||
# Use bash string manipulation to create vars
|
# Use bash string manipulation to create vars
|
||||||
# Note runner.temp isn't available in job.env, so use it here
|
# Note runner context isn't available in job.env, so use it here
|
||||||
|
# https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#context-availability
|
||||||
run: |
|
run: |
|
||||||
echo "SHA_SHORT=${GITHUB_SHA:0:10}" >> ${GITHUB_ENV}
|
echo "SHA_SHORT=${GITHUB_SHA:0:10}" >> ${GITHUB_ENV}
|
||||||
echo "REPO_LOWER_CASE=${GITHUB_REPOSITORY,,}" >> ${GITHUB_ENV}
|
echo "REPO_LOWER_CASE=${GITHUB_REPOSITORY,,}" >> ${GITHUB_ENV}
|
||||||
|
|
@ -70,16 +71,14 @@ jobs:
|
||||||
with:
|
with:
|
||||||
context: examples/tutorial
|
context: examples/tutorial
|
||||||
push: true
|
push: true
|
||||||
# tags: "ghcr.io/${{ github.repository }}:${{ steps.vars.outputs.sha_short }}"
|
|
||||||
tags: "ghcr.io/${{ env.REPO_LOWER_CASE }}:${{ env.SHA_SHORT }}"
|
tags: "ghcr.io/${{ env.REPO_LOWER_CASE }}:${{ env.SHA_SHORT }}"
|
||||||
cache-from: type=local,src=${{ env.CACHE }}
|
cache-from: type=local,src=${{ env.CACHE }}
|
||||||
cache-to: type=local,dest=${{ env.NEW_CACHE }}
|
cache-to: type=local,dest=${{ env.NEW_CACHE }}
|
||||||
# This ugly bit is necessary if you don't want your cache to grow forever
|
# Only save the latest Docker build layers to the cache, otherwise
|
||||||
# until it hits GitHub's limit of 5GB.
|
# the cache will keep growing indefinitely, past the 10GB max
|
||||||
# Temp fix
|
# https://github.com/docker/build-push-action/issues/252
|
||||||
# https://github.com/docker/build-push-action/issues/252
|
# https://github.com/moby/buildkit/issues/1896
|
||||||
# https://github.com/moby/buildkit/issues/1896
|
- name: Only persist the new cache layers
|
||||||
- name: Move cache
|
|
||||||
run: |
|
run: |
|
||||||
rm -rf $CACHE
|
rm -rf ${CACHE)
|
||||||
mv $NEW_CACHE $CACHE
|
mv ${NEW_CACHE} ${CACHE}
|
||||||
|
|
|
||||||
11
examples/tutorial/Dockerfile
Normal file
11
examples/tutorial/Dockerfile
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
FROM python:3.11.2-alpine3.17
|
||||||
|
|
||||||
|
COPY . "/tutorial"
|
||||||
|
WORKDIR /tutorial
|
||||||
|
|
||||||
|
RUN pip install .
|
||||||
|
RUN flask --app=flaskr init-db
|
||||||
|
|
||||||
|
EXPOSE 5000
|
||||||
|
|
||||||
|
CMD [ "flask", "--app=flaskr", "run", "--host=0.0.0.0"]
|
||||||
Loading…
Add table
Add a link
Reference in a new issue