From 595a53b12ac60ac6b36b75c7b6295545e1c58c74 Mon Sep 17 00:00:00 2001 From: Ed Brannin Date: Mon, 18 Dec 2023 21:44:45 -0500 Subject: [PATCH 1/3] Create docker-image.yml --- .github/workflows/docker-image.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .github/workflows/docker-image.yml diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml new file mode 100644 index 0000000..7332288 --- /dev/null +++ b/.github/workflows/docker-image.yml @@ -0,0 +1,18 @@ +name: Docker Image CI + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Build the Docker image + run: docker build . --file Dockerfile --tag contacts:$(date +%s) From a0ffd28ba4d8558fd8e42296afa1bbf3d03ec359 Mon Sep 17 00:00:00 2001 From: Ed Brannin Date: Mon, 18 Dec 2023 22:38:15 -0500 Subject: [PATCH 2/3] Update docker-image.yml Use Python3 --- .github/workflows/docker-image.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 7332288..18ed876 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -14,5 +14,11 @@ jobs: 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) From 7c853804c61d1096c50e60da043594d0091ef120 Mon Sep 17 00:00:00 2001 From: Ed Brannin Date: Mon, 18 Dec 2023 22:41:39 -0500 Subject: [PATCH 3/3] Update Dockerfile --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index e378793..171b132 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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/