From 0752d928767501edcd92bbfcd0320759213aec54 Mon Sep 17 00:00:00 2001 From: kchiranjewee63 Date: Fri, 19 Jul 2024 18:02:10 -0400 Subject: [PATCH] Publish gateway, order, and stocks docker images --- .github/workflows/gateway-image-publish.yml | 41 +++++++++++++++++++++ .github/workflows/order-image-publish.yml | 41 +++++++++++++++++++++ .github/workflows/stocks-image-publish.yml | 41 +++++++++++++++++++++ gateway/Dockerfile | 2 +- order/Dockerfile | 2 +- stocks/Dockerfile | 2 +- 6 files changed, 126 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/gateway-image-publish.yml create mode 100644 .github/workflows/order-image-publish.yml create mode 100644 .github/workflows/stocks-image-publish.yml diff --git a/.github/workflows/gateway-image-publish.yml b/.github/workflows/gateway-image-publish.yml new file mode 100644 index 0000000..a5395d7 --- /dev/null +++ b/.github/workflows/gateway-image-publish.yml @@ -0,0 +1,41 @@ +name: Publish Gateway images + +on: + push: + branches: + - main + +jobs: + build-and-push: + runs-on: ubuntu-latest + permissions: + contents: write + packages: write + deployments: write + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Log in to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Build and push Docker image + uses: docker/build-push-action@v4 + with: + context: gateway + file: ./gateway/Dockerfile + platforms: linux/amd64,linux/arm64 + push: true + tags: | + ghcr.io/${{ github.repository }}/gateway:latest \ No newline at end of file diff --git a/.github/workflows/order-image-publish.yml b/.github/workflows/order-image-publish.yml new file mode 100644 index 0000000..c5ee317 --- /dev/null +++ b/.github/workflows/order-image-publish.yml @@ -0,0 +1,41 @@ +name: Publish Order images + +on: + push: + branches: + - main + +jobs: + build-and-push: + runs-on: ubuntu-latest + permissions: + contents: write + packages: write + deployments: write + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Log in to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Build and push Docker image + uses: docker/build-push-action@v4 + with: + context: order + file: ./order/Dockerfile + platforms: linux/amd64,linux/arm64 + push: true + tags: | + ghcr.io/${{ github.repository }}/order:latest \ No newline at end of file diff --git a/.github/workflows/stocks-image-publish.yml b/.github/workflows/stocks-image-publish.yml new file mode 100644 index 0000000..b00bd0d --- /dev/null +++ b/.github/workflows/stocks-image-publish.yml @@ -0,0 +1,41 @@ +name: Publish Stocks images + +on: + push: + branches: + - main + +jobs: + build-and-push: + runs-on: ubuntu-latest + permissions: + contents: write + packages: write + deployments: write + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Log in to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Build and push Docker image + uses: docker/build-push-action@v4 + with: + context: stocks + file: ./stocks/Dockerfile + platforms: linux/amd64,linux/arm64 + push: true + tags: | + ghcr.io/${{ github.repository }}/stocks:latest \ No newline at end of file diff --git a/gateway/Dockerfile b/gateway/Dockerfile index 37ce88c..f629998 100644 --- a/gateway/Dockerfile +++ b/gateway/Dockerfile @@ -1,5 +1,5 @@ # TODO: Use a multi-stage build process to reduce the final image size. -FROM golang:1.22.0 AS builder +FROM --platform=$BUILDPLATFORM golang:1.22.0 AS builder WORKDIR /app diff --git a/order/Dockerfile b/order/Dockerfile index 206c6df..60e113f 100644 --- a/order/Dockerfile +++ b/order/Dockerfile @@ -1,5 +1,5 @@ # TODO: Use a multi-stage build process to reduce the final image size. -FROM golang:1.22.0 AS builder +FROM --platform=$BUILDPLATFORM golang:1.22.0 AS builder WORKDIR /app diff --git a/stocks/Dockerfile b/stocks/Dockerfile index 206c6df..60e113f 100644 --- a/stocks/Dockerfile +++ b/stocks/Dockerfile @@ -1,5 +1,5 @@ # TODO: Use a multi-stage build process to reduce the final image size. -FROM golang:1.22.0 AS builder +FROM --platform=$BUILDPLATFORM golang:1.22.0 AS builder WORKDIR /app