Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: Support multi-arch builds with dockerfile #160

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
FROM node:20-alpine AS build
FROM node:20-alpine AS amd64-build
FROM arm64v8/node:20-alpine AS arm64-build
FROM ${TARGETARCH}-build AS build

ARG BUILD_TIMESTAMP
ARG BUILD_COMMIT_HASH
Expand All @@ -12,12 +14,16 @@ WORKDIR /app

COPY package.json ./
COPY yarn.lock ./
RUN yarn --frozen-lockfile
# timeout is a required fix for arm64 builds
RUN yarn --frozen-lockfile --network-timeout 1000000

COPY . ./
RUN yarn build

FROM nginx
# https://github.com/docker-library/official-images#architectures-other-than-amd64
FROM nginx AS amd64-nginx
FROM arm64v8/nginx AS arm64-nginx
FROM ${TARGETARCH}-nginx

ENV PORT=3000
ENV METAFLOW_SERVICE=/api
Expand All @@ -28,6 +34,5 @@ ENV METAFLOW_HEAD=''
ENV METAFLOW_BODY_BEFORE=''
ENV METAFLOW_BODY_AFTER=''
ENV MF_DEFAULT_TIME_FILTER_DAYS=''

COPY --from=build /app/build /usr/share/nginx/html
COPY nginx.conf.template /etc/nginx/templates/default.conf.template
Loading