-
Notifications
You must be signed in to change notification settings - Fork 5
/
Dockerfile
43 lines (29 loc) · 984 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
35
36
37
38
39
40
41
42
43
FROM node:20.14 as dev
ENV YARN_CACHE_FOLDER=/root/.yarn
WORKDIR /app
COPY . .
RUN --mount=type=cache,id=yarn,target=/root/.yarn \
yarn install --frozen-lockfile --ignore-engines \
&& yarn build
# Production npm modules
FROM node:20.14 as prod
ENV YARN_CACHE_FOLDER=/root/.yarn
WORKDIR /app
COPY --from=dev /app/package.json /app
COPY --from=dev /app/build/ /app/build
RUN --mount=type=cache,id=yarn,target=/root/.yarn \
yarn install --production --frozen-lockfile --ignore-engines
# Install foundy
ENV FOUNDRY_DIR=/root/.foundry
RUN mkdir ${FOUNDRY_DIR} && \
curl -L https://foundry.paradigm.xyz | bash && \
${FOUNDRY_DIR}/bin/foundryup
# Final image
FROM gcr.io/distroless/nodejs20-debian12
ARG PACKAGE_VERSION
ENV PACKAGE_VERSION=${PACKAGE_VERSION:-dev}
LABEL org.opencontainers.image.version="${PACKAGE_VERSION}"
WORKDIR /app
COPY --from=prod /app /app
COPY --from=prod /root/.foundry/bin/cast /app
CMD ["--enable-source-maps", "/app/build/index.mjs"]