From 314519a8a8ee5bbe92b1188923abb9e30b39bbd0 Mon Sep 17 00:00:00 2001 From: Eric P Date: Sat, 25 Mar 2023 20:03:56 -0500 Subject: [PATCH] docker --- Dockerfile | 10 ++++++++++ docker-compose.yml | 14 ++++++++++++++ docker/nginx.conf | 17 +++++++++++++++++ 3 files changed, 41 insertions(+) create mode 100644 Dockerfile create mode 100644 docker-compose.yml create mode 100644 docker/nginx.conf diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..81bb8d2d --- /dev/null +++ b/Dockerfile @@ -0,0 +1,10 @@ +FROM node:16 + +WORKDIR /var/www/html +COPY . /var/www/html + +RUN corepack enable \ + && corepack prepare yarn@stable --activate \ + && yarn install + +ENTRYPOINT ["yarn", "production"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..3c18489d --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,14 @@ +services: + nginx: + image: nginx + ports: + - '8000:80' + volumes: + - ./docker/nginx.conf:/etc/nginx/conf.d/default.conf + server: + build: . + entrypoint: ['yarn', 'production'] + expose: + - 5001 + volumes: + - .:/var/www/html \ No newline at end of file diff --git a/docker/nginx.conf b/docker/nginx.conf new file mode 100644 index 00000000..55a9ae33 --- /dev/null +++ b/docker/nginx.conf @@ -0,0 +1,17 @@ +server { + if ($host = www.podcastindex.org) { + return 302 https://podcastindex.org$request_uri; + } + + root /var/www/html; + index index.html; + server_name www.podcastindex.org podcastindex.org localhost; + location / { + proxy_set_header X-Forwarded-For $remote_addr; + proxy_set_header Host $http_host; + #proxy_pass http://127.0.0.1:8000; # First attempt to serve request as file, then + proxy_pass http://server:5001; # First attempt to serve request as file, then + } + listen 80 default_server; + add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always; +}