Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create docker-image.yml #12

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Docker Image CI

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:

build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v5.0.0
with:
# Version range or exact version of Python or PyPy to use, using SemVer's version range syntax. Reads from .python-version if unset.
python-version: 3.11
cache: pip
- name: Build the Docker image
run: docker build . --file Dockerfile --tag contacts:$(date +%s)
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ WORKDIR /app/web
RUN apk update && \
apk add py-pillow build-base ca-certificates libffi-dev && \
rm -rf /var/cache/apk/*
RUN pip3 install --no-cache-dir --upgrade pip setuptools wheel
RUN python3 -m pip install --no-cache-dir --upgrade pip setuptools wheel

ENV FLASK_APP=contacts SIM_CONTACTS_SETTINGS=config.py FLASK_DEBUG=0

# https://docs.docker.com/engine/userguide/eng-image/dockerfile_best-practices/#add-or-copy
# Try not to invalidate the `pip install` step by copything everything else after
COPY requirements.txt /app/web/
RUN pip3 install --no-cache-dir -r requirements.txt && mkdir -p /app/web/instance
RUN python3 -m pip install --no-cache-dir -r requirements.txt && mkdir -p /app/web/instance

RUN rm /app/web/app.py
COPY . /app/web/
Expand Down
Loading