Setup nginx.conf and Dockerfile to build frontend application and run docker container
This commit is contained in:
parent
6b5d0528bb
commit
96f35a2bcd
2 changed files with 26 additions and 0 deletions
12
Dockerfile
Normal file
12
Dockerfile
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
FROM node:22 as build
|
||||||
|
WORKDIR /app
|
||||||
|
COPY package*.json ./
|
||||||
|
RUN npm install
|
||||||
|
COPY . .
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
|
FROM nginx:alpine
|
||||||
|
COPY --from=build /app/build /usr/share/nginx/html
|
||||||
|
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
||||||
|
EXPOSE 5137
|
||||||
|
CMD ["nginx", "-g", "daemon off;"]
|
||||||
14
nginx.conf
Normal file
14
nginx.conf
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
server {
|
||||||
|
listen 5137;
|
||||||
|
root /usr/share/nginx/html;
|
||||||
|
index index.html;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
try_files $uri $uri/ /index.html;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~* \.(?:jpg|jpeg|gif|png|ico|svg|woff|woff2|ttf|css|js)$ {
|
||||||
|
expires 30d;
|
||||||
|
add_header Cache-Control "public, no-transform";
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue