@ -1,28 +1,30 @@
FROM node:14.16-alpine AS BUILD_IMAGE
FROM node:14.16-alpine AS BUILD_IMAGE
WORKDIR /app
ARG TARGETPLATFORM
ARG TARGETPLATFORM
ENV TARGETPLATFORM = ${ TARGETPLATFORM :- linux /amd64 }
ENV TARGETPLATFORM = ${ TARGETPLATFORM :- linux /amd64 }
ARG COMMIT_TAG
ENV COMMIT_TAG = ${ COMMIT_TAG }
COPY . /app
WORKDIR /app
RUN \
RUN \
case " ${ TARGETPLATFORM } " in \
case " ${ TARGETPLATFORM } " in \
'linux/arm64' ) apk add --no-cache python make g++ ; ; \
'linux/arm64' ) apk add --no-cache python make g++ ; ; \
'linux/arm/v7' ) apk add --no-cache python make g++ ; ; \
'linux/arm/v7' ) apk add --no-cache python make g++ ; ; \
esac
esac
RUN yarn --frozen-lockfile --network-timeout 1000000 && \
COPY package.json yarn.lock ./
yarn build
RUN yarn install --frozen-lockfile --network-timeout 1000000
COPY . ./
ARG COMMIT_TAG
ENV COMMIT_TAG = ${ COMMIT_TAG }
RUN yarn build
# remove development dependencies
# remove development dependencies
RUN yarn install --production --ignore-scripts --prefer-offline
RUN yarn install --production --ignore-scripts --prefer-offline
RUN rm -rf src && \
RUN rm -rf src server
rm -rf server
RUN touch config/DOCKER
RUN touch config/DOCKER
@ -31,11 +33,12 @@ RUN echo "{\"commitTag\": \"${COMMIT_TAG}\"}" > committag.json
FROM node:14.16-alpine
FROM node:14.16-alpine
WORKDIR /app
RUN apk add --no-cache tzdata tini
RUN apk add --no-cache tzdata tini
# copy from build image
# copy from build image
COPY --from= BUILD_IMAGE /app /app
COPY --from= BUILD_IMAGE /app ./
WORKDIR /app
ENTRYPOINT [ "/sbin/tini" , "--" ]
ENTRYPOINT [ "/sbin/tini" , "--" ]
CMD [ "yarn" , "start" ]
CMD [ "yarn" , "start" ]