-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile.cached
30 lines (22 loc) · 972 Bytes
/
Dockerfile.cached
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
FROM gplane/pnpm:node18-alpine as build-env
RUN apk add tzdata
ENV TZ=Europe/Prague
ENV CI=true
COPY ./packages/shared /app/shared
COPY ./packages/server /app/server
WORKDIR /app/server
RUN pnpm install --frozen-lockfile
RUN pnpm run build
RUN pnpm prune --prod
FROM gplane/pnpm:node18-alpine
COPY ./packages/client/dist /app/client/dist
COPY --from=build-env /app/server/dist /app/server/dist
COPY --from=build-env /app/server/node_modules /app/server/node_modules
COPY --from=build-env /app/server/secret /app/server/secret
COPY --from=build-env /app/server/package.json /app/server/package.json
WORKDIR /app/server
RUN BUILD_TIMESTAMP=$(date +'%a %d.%m.%Y %H:%M') && \
echo "Build Timestamp during build: $BUILD_TIMESTAMP" && \
echo "BUILD_TIMESTAMP=\"$BUILD_TIMESTAMP\"" > /app/server/.build_env
RUN echo "source /app/server/.build_env" >> /etc/profile
CMD ["/bin/sh", "-c", "source /app/server/.build_env && pnpm start:dist -- \"$BUILD_TIMESTAMP\""]