diff --git a/Dockerfile b/Dockerfile index af5cf59..0fe8c44 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ FROM node:18-alpine3.15 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 WORKDIR /opt/seasoned @@ -12,6 +12,7 @@ COPY yarn.lock /opt/seasoned COPY package.json /opt/seasoned COPY server.ts /opt/seasoned COPY webpack.config.js /opt/seasoned +COPY nginx.conf /etc/nginx/http.d/default.conf COPY tsconfig**.json /opt/seasoned/ RUN chown -R node:node /opt/seasoned @@ -22,6 +23,6 @@ RUN yarn install RUN yarn build -EXPOSE 5001 +EXPOSE 5000 CMD ["yarn", "start"] diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..21226f0 --- /dev/null +++ b/nginx.conf @@ -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; + } +}