-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
50 lines (29 loc) · 894 Bytes
/
Dockerfile
File metadata and controls
50 lines (29 loc) · 894 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
41
42
43
44
45
46
47
48
49
50
ARG NODE=alpine:latest
# Stage 1: Development environment
FROM ${NODE} AS development
RUN apk update && apk add --no-cache libc6-compat nodejs yarn
WORKDIR /app
COPY package.json .
RUN if [ -f "yarn.lock" ]; then COPY yarn.lock ./; fi
RUN yarn set version stable
COPY . .
RUN yarn install --silent
CMD ["yarn", "dev"]
# Stage 2: Build production image
FROM ${NODE} AS builder
RUN apk update && apk add --no-cache nodejs yarn
ENV VITE_RAWG_API_KEY=${VITE_RAWG_API_KEY}
ENV VITE_RAWG_BASE_URL=${VITE_RAWG_BASE_URL}
WORKDIR /app
COPY package.json .
RUN if [ -f "yarn.lock" ]; then COPY yarn.lock ./; fi
RUN yarn set version stable
COPY . .
RUN yarn install --silent
RUN yarn build
# Stage 3: Serve production image
FROM nginx:alpine
COPY --from=builder /app/dist /usr/share/nginx/html
COPY nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]