-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
42 lines (31 loc) · 1.07 KB
/
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
ARG BASEIMAGE
FROM ${BASEIMAGE:-"node:22.12.0-alpine"} AS prod
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable pnpm
WORKDIR /app
# prepare system
ENV NODE_ENV=production
RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nodejs
# to optimize docker layer caching, copy the minimum set of files needed to fetch dependencies
COPY .npmrc pnpm-lock.yaml ./
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm fetch --prod
# copy app source
COPY package.json pnpm-workspace.yaml ./
COPY ./packages/app/ ./packages/app/
COPY ./packages/lit-ssr-demo/ ./packages/lit-ssr-demo/
# install prod dependencies fetched in earlier step
RUN --mount=type=cache,id=pnpm,target=/pnpm/store \
pnpm --dir ./packages/app install --prod --offline --frozen-lockfile --ignore-scripts
# run app
USER nodejs
# ensure pnpm is installed in image
RUN pnpm --version
# set default ports, overide with `docker run -e PORT=80 -p 80:80`
ENV PORT=7777
EXPOSE 7777
HEALTHCHECK CMD pnpm run -s healthcheck
ENV APP_TITLE="Hello Dockerfile!"
# start app
CMD ["pnpm", "start"]