From 5b518cf8a9a9904cc91b65590760ad1159fbb5bf Mon Sep 17 00:00:00 2001 From: area363 Date: Wed, 24 Jul 2024 16:15:35 +0900 Subject: [PATCH] build arm image --- .github/workflows/publish_docker_image.yaml | 15 ++++++++------- Dockerfile.amd64 | 18 ++++++++++++++++++ Dockerfile.arm64v8 | 18 ++++++++++++++++++ 3 files changed, 44 insertions(+), 7 deletions(-) create mode 100644 Dockerfile.amd64 create mode 100644 Dockerfile.arm64v8 diff --git a/.github/workflows/publish_docker_image.yaml b/.github/workflows/publish_docker_image.yaml index 5aa28f8..cecb850 100644 --- a/.github/workflows/publish_docker_image.yaml +++ b/.github/workflows/publish_docker_image.yaml @@ -4,15 +4,16 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 - name: Login to DockerHub uses: docker/login-action@v1 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: Build and push multi-arch Docker image + run: | + docker buildx build --platform linux/amd64,linux/arm64 \ + -t planetariumhq/world-boss-service:git-${{ github.sha }} \ + --build-arg COMMIT=git-${{ github.sha }} \ + --push . 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..d4b7da5 --- /dev/null +++ b/Dockerfile.arm64v8 @@ -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