Created
July 27, 2020 12:43
-
-
Save AZagatti/343a8fb6a278f38c291f6091970f98a5 to your computer and use it in GitHub Desktop.
Server config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.git | |
build | |
node_modules | |
.env | |
docker-compose.yml | |
Dockerfile | |
./certs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3.6' | |
services: | |
nginx: | |
build: '.' | |
ports: | |
- '80:80' | |
- '443:443' | |
restart: 'always' | |
environment: | |
- 'NODE_ENV=production' | |
volumes: | |
- ./cert:/etc/nginx/ssl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM node:alpine as build | |
WORKDIR /usr/src/app | |
COPY package.json yarn.lock ./ | |
RUN yarn install | |
COPY . . | |
# Change command to run build | |
RUN yarn build:web | |
FROM nginx:stable-alpine | |
# Change the build output dir | |
COPY --from=build /usr/src/app/web-build /usr/share/nginx/html | |
COPY --from=build /usr/src/app/nginx.conf /etc/nginx/conf.d/default.conf | |
EXPOSE 80 | |
EXPOSE 443 | |
CMD ["nginx", "-g", "daemon off;"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 80 default_server; | |
server_name _; | |
return 301 https://$host$request_uri; | |
} | |
server { | |
listen 443 ssl; | |
ssl_certificate /etc/nginx/ssl/public.crt; | |
ssl_certificate_key /etc/nginx/ssl/private.key; | |
location / { | |
root /usr/share/nginx/html; | |
index index.html index.htm; | |
try_files $uri $uri/ /index.html; | |
} | |
include /etc/nginx/extra-conf.d/*.conf; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment