From 772eab44cac58dd671bf77c2649c521336e17e94 Mon Sep 17 00:00:00 2001 From: Bowen Liang Date: Fri, 15 Nov 2024 13:27:08 +0800 Subject: [PATCH] update --- .github/workflows/docker-build.yml | 47 ++++++++++++++++++++++++++++++ api/Dockerfile | 5 ++-- web/Dockerfile | 1 - 3 files changed, 49 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/docker-build.yml diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml new file mode 100644 index 00000000000000..cf7e77b4b829ea --- /dev/null +++ b/.github/workflows/docker-build.yml @@ -0,0 +1,47 @@ +name: Build docker image + +on: + pull_request: + branches: + - "main" + paths: + - api/Dockerfile + - web/Dockerfile + +concurrency: + group: docker-build-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + build-docker: + runs-on: ubuntu-latest + strategy: + matrix: + include: + - service_name: "api-amd64" + platform: linux/amd64 + context: "api" + - service_name: "api-arm64" + platform: linux/arm64 + context: "api" + - service_name: "web-amd64" + platform: linux/amd64 + context: "web" + - service_name: "web-arm64" + platform: linux/arm64 + context: "web" + steps: + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Build Docker Image + uses: docker/build-push-action@v6 + with: + push: false + context: "{{defaultContext}}:${{ matrix.context }}" + platforms: ${{ matrix.platform }} + cache-from: type=gha + cache-to: type=gha,mode=max diff --git a/api/Dockerfile b/api/Dockerfile index b5b8f69829d918..24c1817d10126a 100644 --- a/api/Dockerfile +++ b/api/Dockerfile @@ -23,8 +23,8 @@ FROM base AS packages # if you located in China, you can use aliyun mirror to speed up # RUN sed -i 's@deb.debian.org@mirrors.aliyun.com@g' /etc/apt/sources.list.d/debian.sources -RUN apt-get update \ - && apt-get install -y --no-install-recommends gcc g++ libc-dev libffi-dev libgmp-dev libmpfr-dev libmpc-dev +#RUN apt-get update \ +# && apt-get install -y --no-install-recommends gcc g++ libc-dev libffi-dev libgmp-dev libmpfr-dev libmpc-dev # Install Python dependencies COPY pyproject.toml poetry.lock ./ @@ -76,7 +76,6 @@ COPY . /app/api/ COPY docker/entrypoint.sh /entrypoint.sh RUN chmod +x /entrypoint.sh - ARG COMMIT_SHA ENV COMMIT_SHA=${COMMIT_SHA} diff --git a/web/Dockerfile b/web/Dockerfile index 6118adbca4c447..6c341fac4e23a3 100644 --- a/web/Dockerfile +++ b/web/Dockerfile @@ -63,7 +63,6 @@ RUN yarn global add pm2 \ && chown -R 1001:0 /.pm2 /app/web \ && chmod -R g=u /.pm2 /app/web - ARG COMMIT_SHA ENV COMMIT_SHA=${COMMIT_SHA}