Nginx install and simple config

This commit is contained in:
2022-08-14 00:21:15 +02:00
parent cf0bd9aa84
commit 97ed8a491e
2 changed files with 33 additions and 2 deletions

View File

@@ -1,7 +1,7 @@
FROM node:18-alpine3.15 FROM node:18-alpine3.15
LABEL org.opencontainers.image.source https://github.com/kevinmidboe/seasoned LABEL org.opencontainers.image.source https://github.com/kevinmidboe/seasoned
RUN apk update && apk add curl RUN apk update && apk add curl && apt add nginx
RUN mkdir -p /opt/seasoned/node_modules RUN mkdir -p /opt/seasoned/node_modules
WORKDIR /opt/seasoned WORKDIR /opt/seasoned
@@ -12,6 +12,7 @@ COPY yarn.lock /opt/seasoned
COPY package.json /opt/seasoned COPY package.json /opt/seasoned
COPY server.ts /opt/seasoned COPY server.ts /opt/seasoned
COPY webpack.config.js /opt/seasoned COPY webpack.config.js /opt/seasoned
COPY nginx.conf /etc/nginx/http.d/default.conf
COPY tsconfig**.json /opt/seasoned/ COPY tsconfig**.json /opt/seasoned/
RUN chown -R node:node /opt/seasoned RUN chown -R node:node /opt/seasoned
@@ -22,6 +23,6 @@ RUN yarn install
RUN yarn build RUN yarn build
EXPOSE 5001 EXPOSE 5000
CMD ["yarn", "start"] CMD ["yarn", "start"]

30
nginx.conf Normal file
View File

@@ -0,0 +1,30 @@
server {
listen 5000 default_server;
listen [::]:5000 default_server;
# server_name request.movie;
root /opt/seasoned/public;
gzip on;
gzip_types application/javascript;
gzip_min_length 1000;
gzip_static on;
location /favicons {
autoindex on;
}
location /dist {
add_header Content-Type application/javascript;
try_files $uri =404;
}
location /api {
proxy_pass https://request.movie/api;
}
location / {
try_files $uri $uri/ /index.html;
index index.html;
}
}