From dd358b4d8669765c5d0df4794b5bb040249a5111 Mon Sep 17 00:00:00 2001 From: arodindev Date: Sun, 4 Aug 2024 09:08:08 +0200 Subject: [PATCH] fix(Dockerfile): add mongodb env variables --- .github/workflows/build-image.yaml | 28 ++++++++++++++++++++++++++++ docker/Dockerfile | 3 +++ 2 files changed, 31 insertions(+) create mode 100644 .github/workflows/build-image.yaml diff --git a/.github/workflows/build-image.yaml b/.github/workflows/build-image.yaml new file mode 100644 index 0000000..862b1d5 --- /dev/null +++ b/.github/workflows/build-image.yaml @@ -0,0 +1,28 @@ +name: publish +on: + push: + tags: + - 'v*' + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: docker-login + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Build and push + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/Dockerfile + push: true + tags: ghcr.io/${{github.repository_owner}}/todoapp:${{github.ref_name}} + diff --git a/docker/Dockerfile b/docker/Dockerfile index bb00a13..f92661a 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -21,6 +21,9 @@ RUN poetry export --without-hashes --without dev -f requirements.txt --output re FROM python:3.11.6-slim +ENV MONGODB_URL="mongodb://localhost" \ + MONGODB_URI="mongodb://mongo:27017" + WORKDIR /todoapp COPY --from=base /tmp/requirements.txt /todoapp/requirements.txt