-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
36 lines (25 loc) · 905 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
# Use an official node runtime as a parent image - Build stage
FROM node:16-alpine as build-image
WORKDIR /app/
# Copy all source and config files
COPY . /app/
# Install dependencies and avoid `node-gyp rebuild` errors
RUN \
apk add --no-cache --virtual .gyp build-base python3 && \
yarn install && \
yarn build && \
apk del .gyp && \
yarn cache clean --all
# Use an official node runtime as a parent image - Runtime
FROM node:16-alpine as runtime
WORKDIR /app/
# Copy node_modules from build stage to have access to scripts
COPY --from=build-image /app/node_modules /app/node_modules
# Copy prebuilt assets
COPY --from=build-image /app/dist/ /app/dist/
# Copy runtime files
COPY --from=build-image /app/package.json /app/
# Copy prebuilt assets
COPY --from=build-image /app/vite.config.ts /app/vite.config.ts
EXPOSE 3000
CMD ["yarn", "preview", "--host", "--port", "3000"]