-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
31 lines (27 loc) · 721 Bytes
/
Dockerfile
File metadata and controls
31 lines (27 loc) · 721 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
FROM node:22.22.2-alpine AS base
RUN mkdir -p /opt/app
WORKDIR /opt/app
RUN adduser -S user
RUN chown -R user /opt/app
COPY package*.json ./
COPY yarn.lock ./
# Install specific version of Yarn
# directly from Alpine package manager
RUN corepack enable && corepack prepare yarn@1.22.22 --activate
# DEVELOPMENT APP PROFILE
FROM base AS development
RUN yarn install
COPY . ./
EXPOSE 3000
CMD ["yarn", "dev:docker"]
# BUILD TARGET
FROM base AS build
COPY . ./
USER user
# PRODUCTION CLIENT PROFILE
FROM nginx:1.22.0-alpine AS production
COPY --from=build /opt/app/public /usr/share/nginx/html
RUN rm /etc/nginx/conf.d/default.conf
COPY config/nginx.conf /etc/nginx/conf.d
EXPOSE 3000
CMD ["nginx", "-g", "daemon off;"]