-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.standalone
35 lines (27 loc) · 983 Bytes
/
Dockerfile.standalone
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
# docker file which works fine in Azure AKS / Kubernetes
# nginx.conf file lies near it
# build environment
FROM node:14.21.1-alpine as build
# proxy config
ENV HTTP_PROXY="YOUR_PROXY_TO_BUILD_APP"
ENV HTTPS_PROXY="YOUR_PROXY_TO_BUILD_APP"
ENV no_proxy="127.0.0.1,localhost"
# set working directory
WORKDIR /app
ENV PATH /app/node_modules/.bin:$PATH
# add app dependencies and registry configurations
COPY .npmrc ./
COPY package.json ./
# install and build application
RUN npm install
COPY . ./
# if you have several env files - .env.development.local will be ignored and only .env.production will be used due to npm run build command
RUN npm run build
# Image with Nginx
From nginxinc/nginx-unprivileged:stable-alpine
COPY --from=build --chown=nginx:0 /app/build /usr/share/nginx/app
# nginx config should be in the ROOT_FOLDER/nginx/nginx.conf
COPY --chown=nginx:0 /nginx/nginx.conf /etc/nginx/conf/d/default.conf
WORKDIR /app
EXPOSE 3000
CMD ["nginx", "-g", "daemon off;"]