diff --git a/.github/workflows/publish_docker_image.yaml b/.github/workflows/publish_docker_image.yaml index 5aa28f8..3b4933c 100644 --- a/.github/workflows/publish_docker_image.yaml +++ b/.github/workflows/publish_docker_image.yaml @@ -9,10 +9,28 @@ jobs: with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_ACCESS_TOKEN }} - - name: Build and push - id: docker_build - uses: docker/build-push-action@v2 - with: - context: . - push: true - tags: planetariumhq/world-boss-service:git-${{ github.sha }} + - name: setup-qemu + run: | + docker run --rm --privileged multiarch/qemu-user-static \ + --reset \ + -p yes + - name: build-and-push-amd64 + run: | + docker build . \ + -f Dockerfile.amd64 \ + -t planetariumhq/world-boss-service:git-${{ github.sha }}-amd64 \ + --build-arg COMMIT=git-${{ github.sha }} + docker push planetariumhq/world-boss-service:git-${{ github.sha }}-amd64 + - name: build-and-push-arm64v8 + run: | + docker build . \ + -f Dockerfile.arm64v8 \ + -t planetariumhq/world-boss-service:git-${{ github.sha }}-arm64v8 \ + --build-arg COMMIT=git-${{ github.sha }} + docker push planetariumhq/world-boss-service:git-${{ github.sha }}-arm64v8 + - name: merge-manifest-and-push + run: | + docker manifest create planetariumhq/world-boss-service:git-${{ github.sha }} \ + --amend planetariumhq/world-boss-service:git-${{ github.sha }}-amd64 \ + --amend planetariumhq/world-boss-service:git-${{ github.sha }}-arm64v8 + docker manifest push planetariumhq/world-boss-service:git-${{ github.sha }} diff --git a/Dockerfile.amd64 b/Dockerfile.amd64 new file mode 100644 index 0000000..d4b7da5 --- /dev/null +++ b/Dockerfile.amd64 @@ -0,0 +1,18 @@ +FROM python:3.10.8-bullseye + +ARG POETRY_VERSION=1.2.2 + +RUN apt-get update +RUN apt-get install -y postgresql-client vim jq + +# Set up poetry +RUN pip install -U pip "poetry==${POETRY_VERSION}" +RUN poetry config virtualenvs.create false + +COPY ./world_boss /app/world_boss +COPY pyproject.toml /app +COPY poetry.lock /app +COPY alembic.ini /app + +WORKDIR /app +RUN poetry install --no-root --no-dev diff --git a/Dockerfile.arm64v8 b/Dockerfile.arm64v8 new file mode 100644 index 0000000..983a1d7 --- /dev/null +++ b/Dockerfile.arm64v8 @@ -0,0 +1,18 @@ +FROM python:3.10.14-slim-bullseye⁠ + +ARG POETRY_VERSION=1.2.2 + +RUN apt-get update +RUN apt-get install -y postgresql-client vim jq + +# Set up poetry +RUN pip install -U pip "poetry==${POETRY_VERSION}" +RUN poetry config virtualenvs.create false + +COPY ./world_boss /app/world_boss +COPY pyproject.toml /app +COPY poetry.lock /app +COPY alembic.ini /app + +WORKDIR /app +RUN poetry install --no-root --no-dev