-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathDockerfile
More file actions
40 lines (24 loc) · 733 Bytes
/
Copy pathDockerfile
File metadata and controls
40 lines (24 loc) · 733 Bytes
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
# syntax=docker/dockerfile:1
############ Base Image ###########
FROM node:alpine AS base
ENV SHELL=bash
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN npm install -g pnpm
WORKDIR /app
######### Install Packages ########
FROM base AS deps
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
RUN pnpm install --frozen-lockfile
######## Build Application ########
FROM base AS build
COPY --from=deps /app/node_modules ./node_modules
COPY . ./
RUN --mount=type=secret,id=dotenv,target=/app/.env,required=true \
pnpm build
########## Runtime Image ##########
FROM node:alpine AS runtime
WORKDIR /app
ENV NODE_ENV=production
COPY --from=build /app/.output ./.output
CMD ["node", ".output/server/index.mjs"]