浏览代码

chore: docker multiarch (#417)

Shuyoou 1 年之前
父节点
当前提交
79499968d2
共有 1 个文件被更改,包括 6 次插入2 次删除
  1. 6 2
      Dockerfile

+ 6 - 2
Dockerfile

@@ -1,8 +1,12 @@
 # => Building container
 # => Building container
-FROM node:18-slim as builder
+FROM --platform=$BUILDPLATFORM node:18-slim as builder
 WORKDIR /app
 WORKDIR /app
 COPY . .
 COPY . .
 
 
+ARG TARGETPLATFORM
+ARG BUILDPLATFORM
+RUN echo "I am running on $BUILDPLATFORM, building for $TARGETPLATFORM"
+
 # => Building Client
 # => Building Client
 WORKDIR /app/client
 WORKDIR /app/client
 RUN yarn install
 RUN yarn install
@@ -15,7 +19,7 @@ ENV PORT 80
 RUN yarn build
 RUN yarn build
 
 
 # => Copy to Final container
 # => Copy to Final container
-FROM node:18-slim
+FROM --platform=$BUILDPLATFORM node:18-slim
 WORKDIR /app
 WORKDIR /app
 COPY --from=builder /app/server/dist /app/dist
 COPY --from=builder /app/server/dist /app/dist
 COPY --from=builder /app/client/build /app/build
 COPY --from=builder /app/client/build /app/build