Added Dockerfile.
This commit is contained in:
parent
9563a5f2c0
commit
a21710d624
10
.dockerignore
Normal file
10
.dockerignore
Normal file
@ -0,0 +1,10 @@
|
||||
# Ignore everything by default
|
||||
*
|
||||
|
||||
# Allow the public project files.
|
||||
!src
|
||||
!public
|
||||
!Dockerfile
|
||||
!package*.json
|
||||
!README.md
|
||||
!nginx.conf
|
23
Dockerfile
Normal file
23
Dockerfile
Normal file
@ -0,0 +1,23 @@
|
||||
FROM node:16.6.1-alpine AS builder
|
||||
|
||||
WORKDIR /tmp
|
||||
COPY package*.json ./
|
||||
|
||||
RUN npm ci --only=prod
|
||||
COPY . .
|
||||
|
||||
ENV NODE_ENV=production
|
||||
RUN npm run build
|
||||
|
||||
FROM nginx:alpine
|
||||
|
||||
COPY --from=builder /tmp/build /usr/share/nginx/html
|
||||
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
||||
|
||||
RUN touch /var/run/nginx.pid
|
||||
RUN chown -R nginx:nginx /var/run/nginx.pid /usr/share/nginx/html /var/cache/nginx /var/log/nginx /etc/nginx/conf.d
|
||||
USER nginx
|
||||
|
||||
EXPOSE 8080
|
||||
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
10
nginx.conf
Normal file
10
nginx.conf
Normal file
@ -0,0 +1,10 @@
|
||||
server_tokens off;
|
||||
server {
|
||||
listen 8080;
|
||||
server_name localhost;
|
||||
location / {
|
||||
root /usr/share/nginx/html;
|
||||
index index.html index.htm;
|
||||
try_files $uri /index.html;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user