Skip to content

Commit

Permalink
Merge pull request #20 from rohitkumbhar/19-docker-image-architecture
Browse files Browse the repository at this point in the history
#19 Enable multiplatform builds
  • Loading branch information
rohitkumbhar authored Jan 6, 2025
2 parents b44b106 + 079b871 commit e682c89
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/docker-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,14 @@ jobs:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GHCR_PACKAGE_PAT }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
15 changes: 7 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
FROM node:20 AS frontend

FROM --platform=$BUILDPLATFORM node:20 AS frontend
ARG TARGETOS
ARG TARGETARCH

WORKDIR /surmai
RUN mkdir node_modules
Expand All @@ -18,7 +19,9 @@ RUN npm install -g npm@10.3.0 # For windows
RUN npm install --no-audit
RUN npm run build

FROM golang:1.23.4-alpine3.21 AS backend
FROM --platform=$BUILDPLATFORM golang:1.23.4-alpine3.21 AS backend
ARG TARGETOS
ARG TARGETARCH

WORKDIR /build

Expand All @@ -28,15 +31,11 @@ COPY backend/go.sum .
RUN go mod download

COPY backend .
RUN go build -o surmai-backend
RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -o surmai-backend


FROM alpine:3.21

RUN apk add --no-cache \
unzip \
ca-certificates

COPY backend/init.sh /pb/init.sh
COPY backend/datasets /datasets
COPY --from=frontend /surmai/dist /pb_public
Expand Down

0 comments on commit e682c89

Please sign in to comment.