From 7553f1b3df58753cb475a0413b852f5b281f4ef5 Mon Sep 17 00:00:00 2001 From: Yannik Schmidt Date: Tue, 27 Jun 2023 16:13:47 +0200 Subject: [PATCH] feat: github actions docker build --- .github/workflows/main.yaml | 32 ++++++++++++++++++++++++++++++++ Dockerfile | 22 ++++++++++++++++++++++ req.txt | 3 +++ 3 files changed, 57 insertions(+) create mode 100644 .github/workflows/main.yaml create mode 100644 Dockerfile create mode 100644 req.txt diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml new file mode 100644 index 0000000..ead55f2 --- /dev/null +++ b/.github/workflows/main.yaml @@ -0,0 +1,32 @@ +name: Container Build for picture factory CMS + +on: + push: + branches: + - "master" + +jobs: + docker: + runs-on: ubuntu-latest + environment: + name: prod + steps: + - uses: actions/checkout@v3 + - + name: Checkout + uses: actions/checkout@v3 + - + name: Login to Docker Registry + uses: docker/login-action@v2 + with: + registry: ${{ secrets.REGISTRY }} + username: ${{ secrets.REGISTRY_USER }} + password: ${{ secrets.REGISTRY_PASS }} + - + name: picture-factory + uses: docker/build-push-action@v3 + with: + context: . + platforms: linux/amd64 + push: true + tags: "${{ secrets.REGISTRY }}/picture-factory:latest" diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..b3ed1b9 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,22 @@ +FROM python:3.9-slim-buster + +RUN apt update +RUN apt install python3-pip -y +RUN python3 -m pip install --upgrade pip +RUN apt autoremove -y +RUN apt clean + +WORKDIR /app +COPY ./ . + +RUN python3 -m pip install waitress + +COPY req.txt . +RUN python3 -m pip install --no-cache-dir -r req.txt + +RUN mkdir /app/pictures + +EXPOSE 5000/tcp + +ENTRYPOINT ["waitress-serve"] +CMD ["--host", "0.0.0.0", "--port", "5000", "--call", "app:createApp"] diff --git a/req.txt b/req.txt new file mode 100644 index 0000000..a972366 --- /dev/null +++ b/req.txt @@ -0,0 +1,3 @@ +Pillow>=8.1.2 +flask +werkzeug