-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathproduction.dockerfile
63 lines (47 loc) · 1.78 KB
/
production.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# https://hub.docker.com/_/node/tags?page=1&name=bookworm-slim <- look for vulnerabilities
# https://github.com/primer/octicons/blob/main/package.json
FROM --platform=${TARGETPLATFORM} arm64v8/node:20.14.0-alpine3.20 AS build-stage
ARG TARGETPLATFORM TARGETOS TARGETARCH
ENV npm_config_cache=/usr/app/node_modules/.cache
WORKDIR /usr/app
COPY package*.json yarn.lock .yarnrc.yml .
RUN node -p "process.arch" \
&& echo $TARGETPLATFORM && echo $TARGETOS && echo $TARGETARCH
RUN corepack enable \
&& yarn config set --home enableTelemetry 0 \
&& yarn install --immutable --check-cache
# USER 1000:3000
# Error: EACCES: permission denied, mkdir '/usr/app/node_modules/.cache'
# RUN mkdir -p /usr/app/node_modules/.cache \
# /usr/app/node_modules/.cache/babel-loader \
# /usr/app/node_modules/.cache/eslint
# RUN mkdir -p /usr/app/.npm
# RUN npm config set cache /usr/app/.node_modules_cache --global
COPY . .
RUN yarn build
# RUN yarn add pm2
# RUN yarn run serveprod
# CMD ["npx", "yarn", "run", "serveprod"]
# RUN yarn add serve
FROM nginx:1.25.4-alpine3.18-slim AS production-stage
LABEL org.opencontainers.image.source=https://github.com/danroux/sk8l-ui
LABEL org.opencontainers.image.description="sk8l-ui image"
LABEL org.opencontainers.image.licenses=MIT
WORKDIR /app
ENV APP_PORT=8001
EXPOSE $APP_PORT
ENV PORT=$APP_PORT
ENV HOST=0.0.0.0
COPY --from=build-stage /usr/app/dist /app_tmp
# COPY nginx.conf /etc/nginx/nginx.conf
COPY ./run_app.sh /app_tmp
COPY ./replace-env-vars.sh /app_tmp
# STOPSIGNAL SIGQUIT
# RUN addgroup -g 1000 node \
# && adduser -u 1000 -G node -s /bin/sh -D node
# nginx
RUN chown -R 101:101 /app /app_tmp
USER 101
# https://cli.vuejs.org/guide/deployment.html#docker-nginx
# CMD ["./run_app.sh", "&&", "npx", "serve", "-s", "dist"]
CMD ["./run_app.sh"]