-
Notifications
You must be signed in to change notification settings - Fork 0
/
dockerfile
54 lines (46 loc) · 1.57 KB
/
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
##############################
# BUILD
##############################
FROM node:lts-alpine as BUILD
COPY src /usr/src/app/src
COPY public /usr/src/app/public
COPY package.json /usr/src/app/
COPY babel.config.js /usr/src/app/
COPY .eslintrc.js /usr/src/app/src
COPY vue.config.js /usr/src/app/
COPY tailwind.config.js /usr/src/app/
COPY postcss.config.js /usr/src/app/
COPY jsconfig.json /usr/src/app/
WORKDIR /usr/src/app/
RUN yarn install
RUN yarn build
##############################
# PRODUCTION
##############################
# https://blog.openshift.com/deploy-vuejs-applications-on-openshift/
FROM nginx:alpine
RUN apk add --update coreutils
# Add a user how will have the rights to change the files in code
RUN addgroup -g 1500 nginxusers
RUN adduser --disabled-password -u 1501 nginxuser nginxusers
# Configure ngnix server
COPY nginx-webapp.conf /etc/nginx/nginx.conf
WORKDIR /code
COPY --from=BUILD /usr/src/app/dist .
# https://zingzai.medium.com/externalise-and-configure-frontend-environment-variables-on-kubernetes-e8e798285b3e
# Configure web-app for environment variable usage
WORKDIR /
COPY docker_entrypoint.sh .
COPY generate_env-config.sh .
RUN chown nginxuser:nginxusers docker_entrypoint.sh
RUN chown nginxuser:nginxusers generate_env-config.sh
RUN chmod 777 docker_entrypoint.sh generate_env-config.sh
RUN chown -R nginxuser:nginxusers /code
RUN chown -R nginxuser:nginxusers /etc/nginx
RUN chown -R nginxuser:nginxusers /tmp
RUN chmod 777 /code
RUN chmod 777 /tmp
RUN chmod 777 /etc/nginx
USER nginxuser
EXPOSE 8080:8080
CMD ["/bin/sh","docker_entrypoint.sh"]