-
-
Notifications
You must be signed in to change notification settings - Fork 51
/
Dockerfile
41 lines (30 loc) · 837 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
# see https://docs.docker.com/engine/reference/builder/#understand-how-arg-and-from-interact
ARG NODE_VERSION=node:20.6.1
FROM $NODE_VERSION AS dependency-base
# install pnpm
RUN npm i -g pnpm
# create destination directory
RUN mkdir -p /app
WORKDIR /app
# copy the app, note .dockerignore
COPY package.json .
COPY pnpm-lock.yaml .
RUN pnpm i
FROM dependency-base AS production-base
# build will also take care of building
# if necessary
COPY . .
RUN pnpm build
FROM $NODE_VERSION-slim AS production
COPY --from=production-base /app/.output /app/.output
# Service hostname and port
ENV NUXT_HOST=0.0.0.0
ENV NUXT_PORT=80
ENV PORT=80
# Service version
ARG NUXT_APP_VERSION
ENV NUXT_APP_VERSION=${NUXT_APP_VERSION}
# Run in production mode
ENV NODE_ENV=production
# start the app
CMD [ "node", "/app/.output/server/index.mjs" ]