-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
34 lines (21 loc) · 968 Bytes
/
Dockerfile
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
31
32
33
34
FROM gplane/pnpm:node18-alpine as build-env
RUN apk add tzdata openssl
ENV TZ=Europe/Prague
WORKDIR /app
ARG ENV
COPY ./packages .
RUN cd client && pnpm install && BUILD_TIMESTAMP=$(date +'%a %d.%m.%Y %H:%M') pnpm build:${ENV}
RUN rm -rf client/node_modules client/src
WORKDIR /app/server
RUN pnpm install && pnpm build
RUN pnpm prune --prod
RUN mkdir -p ./secret
RUN openssl req -x509 -newkey rsa:2048 -nodes -out ./secret/cert.pem -keyout ./secret/key.pem -days 365 -subj "/C=FR/O=krkr/OU=Domain Control Validated/CN=*"
FROM gplane/pnpm:node18-alpine
COPY --from=build-env /app /app
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\""]