-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathDockerfile
30 lines (28 loc) · 977 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
FROM node:20-slim AS base
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable
FROM base AS build
ARG SENTRY_RELEASE
ENV SENTRY_RELEASE=$SENTRY_RELEASE
RUN apt-get update
RUN apt-get -y install ca-certificates
COPY . /usr/src/app
WORKDIR /usr/src/app
RUN pnpm install --frozen-lockfile
RUN --mount=type=secret,id=SENTRY_AUTH_TOKEN \
SENTRY_AUTH_TOKEN=$(cat /run/secrets/SENTRY_AUTH_TOKEN) && \
export SENTRY_AUTH_TOKEN=$SENTRY_AUTH_TOKEN && \
pnpm run -r build-with-sourcemaps --release $SENTRY_RELEASE
# Comment above and uncomment below to build the image locally (not in CI)
# RUN pnpm --filter=app-builder run build
ENV NODE_ENV=production
RUN pnpm deploy --filter=app-builder --prod /prod/app-builder
FROM base AS app-builder
ENV NODE_ENV=production
ENV PORT=${PORT:-8080}
RUN apt-get update && apt-get install -y curl
COPY --from=build /prod/app-builder /prod/app-builder
WORKDIR /prod/app-builder
EXPOSE $PORT
CMD [ "pnpm", "start"]