feat: init docker setup
parent
b916accc17
commit
40fc9e6e4d
|
@ -0,0 +1,13 @@
|
||||||
|
# build stage
|
||||||
|
FROM node:lts-alpine as build-stage
|
||||||
|
WORKDIR /app
|
||||||
|
COPY package*.json ./
|
||||||
|
RUN npm install
|
||||||
|
COPY . .
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
|
# production stage
|
||||||
|
FROM nginx:stable-alpine as production-stage
|
||||||
|
COPY --from=build-stage /app/public /usr/share/nginx/html
|
||||||
|
EXPOSE 80
|
||||||
|
CMD ["nginx", "-g", "daemon off;"]
|
|
@ -0,0 +1,46 @@
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
server_name localhost;
|
||||||
|
|
||||||
|
#charset koi8-r;
|
||||||
|
#access_log /var/log/nginx/host.access.log main;
|
||||||
|
|
||||||
|
root /usr/share/nginx/html;
|
||||||
|
index index.html;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
try_files $uri /index.html;
|
||||||
|
}
|
||||||
|
|
||||||
|
#error_page 404 /404.html;
|
||||||
|
|
||||||
|
# redirect server error pages to the static page /50x.html
|
||||||
|
#
|
||||||
|
# error_page 500 502 503 504 /50x.html;
|
||||||
|
# location = /50x.html {
|
||||||
|
# root /usr/share/nginx/html;
|
||||||
|
# }
|
||||||
|
|
||||||
|
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
|
||||||
|
#
|
||||||
|
#location ~ \.php$ {
|
||||||
|
# proxy_pass http://127.0.0.1;
|
||||||
|
#}
|
||||||
|
|
||||||
|
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
|
||||||
|
#
|
||||||
|
#location ~ \.php$ {
|
||||||
|
# root html;
|
||||||
|
# fastcgi_pass 127.0.0.1:9000;
|
||||||
|
# fastcgi_index index.php;
|
||||||
|
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
|
||||||
|
# include fastcgi_params;
|
||||||
|
#}
|
||||||
|
|
||||||
|
# deny access to .htaccess files, if Apache's document root
|
||||||
|
# concurs with nginx's one
|
||||||
|
#
|
||||||
|
#location ~ /\.ht {
|
||||||
|
# deny all;
|
||||||
|
#}
|
||||||
|
}
|
|
@ -0,0 +1,54 @@
|
||||||
|
version: '3'
|
||||||
|
|
||||||
|
services:
|
||||||
|
client:
|
||||||
|
container_name: hve_client
|
||||||
|
restart: on-failure
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: ./Dockerfile
|
||||||
|
volumes:
|
||||||
|
- ./client/nginx.conf:/etc/nginx/conf.d/default.conf:ro
|
||||||
|
environment:
|
||||||
|
- NODE_ENV=production
|
||||||
|
networks:
|
||||||
|
- default
|
||||||
|
- web
|
||||||
|
command: ['nginx', '-g', 'daemon off;']
|
||||||
|
# labels:
|
||||||
|
# - 'traefik.docker.network=web'
|
||||||
|
# - 'traefik.enable=true'
|
||||||
|
# - 'traefik.domain=hve.crvx.fr'
|
||||||
|
# - 'traefik.basic.frontend.rule=Host:hve.crvx.fr'
|
||||||
|
# - 'traefik.basic.port=80'
|
||||||
|
# - 'traefik.basic.protocol=http'
|
||||||
|
# - 'traefik.frontend.headers.SSLRedirect=true'
|
||||||
|
# - 'traefik.frontend.headers.STSSeconds=315360000'
|
||||||
|
# - 'traefik.frontend.headers.browserXSSFilter=true'
|
||||||
|
# - 'traefik.frontend.headers.contentTypeNosniff=true'
|
||||||
|
# - 'traefik.frontend.headers.forceSTSHeader=true'
|
||||||
|
# - "traefik.frontend.headers.contentSecurityPolicy=default-src 'self';frame-ancestors 'self';style-src 'self';script-src 'self';img-src 'self';font-src 'self'"
|
||||||
|
# - 'traefik.frontend.headers.referrerPolicy=no-referrer'
|
||||||
|
# - 'traefik.frontend.headers.frameDeny=true'
|
||||||
|
|
||||||
|
api:
|
||||||
|
container_name: hve_api
|
||||||
|
restart: on-failure
|
||||||
|
image: node:8
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: ./server/Dockerfile
|
||||||
|
env_file:
|
||||||
|
- .env
|
||||||
|
environment:
|
||||||
|
- NODE_ENV=production
|
||||||
|
ports:
|
||||||
|
- '3000:3000'
|
||||||
|
networks:
|
||||||
|
- default
|
||||||
|
- postgres
|
||||||
|
command: ['node', '/api/server/index.js']
|
||||||
|
|
||||||
|
networks:
|
||||||
|
web:
|
||||||
|
external: true
|
|
@ -0,0 +1,12 @@
|
||||||
|
FROM node:8
|
||||||
|
|
||||||
|
WORKDIR /api
|
||||||
|
|
||||||
|
COPY ./package-lock.json .
|
||||||
|
COPY ./package.json .
|
||||||
|
COPY ./server ./server
|
||||||
|
|
||||||
|
# Build
|
||||||
|
RUN npm install --prefix /api
|
||||||
|
|
||||||
|
EXPOSE 3000
|
Loading…
Reference in New Issue