-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile.client
More file actions
37 lines (34 loc) · 1.04 KB
/
Copy pathDockerfile.client
File metadata and controls
37 lines (34 loc) · 1.04 KB
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
# build environment
FROM node:19-alpine as build
ENV NODE_VERSION 19.7.0
WORKDIR /app
COPY ./package.json ./
COPY ./pnpm-lock.yaml ./
COPY ./pnpm-workspace.yaml ./
COPY ./client/package.json ./client/
COPY ./shared/package.json ./shared/
ENV PATH /app/node_modules/.bin:$PATH
# Update npm | Install pnpm | Set PNPM_HOME | Install global packages
RUN npm i -g npm@latest; \
# Install pnpm
npm install -g pnpm; \
pnpm --version; \
pnpm setup; \
mkdir -p /usr/local/share/pnpm &&\
export PNPM_HOME="/usr/local/share/pnpm" &&\
export PATH="$PNPM_HOME:$PATH"; \
pnpm bin -g &&\
# Install dependencies
pnpm add -g pm2 &&\
pnpm install
COPY . .
RUN pnpm --filter client run build
# production environment
FROM nginx:stable-alpine
COPY client/nginx.conf /etc/nginx/conf.d/configfile.template
COPY --from=build /app/client/dist /usr/share/nginx/html
ENV PORT 8080
ENV HOST 0.0.0.0
EXPOSE 8080
#CMD ["nginx", "-g", "daemon off;"]
CMD sh -c "envsubst '\$PORT' < /etc/nginx/conf.d/configfile.template > /etc/nginx/conf.d/default.conf && nginx -g 'daemon off;'"