mirror of
https://github.com/EDCD/coriolis.git
synced 2025-12-08 22:33:24 +00:00
initial docker
This commit is contained in:
2
.docker/.dockerignore
Normal file
2
.docker/.dockerignore
Normal file
@@ -0,0 +1,2 @@
|
||||
node_modules
|
||||
npm-debug.log
|
||||
37
.docker/Dockerfile
Normal file
37
.docker/Dockerfile
Normal file
@@ -0,0 +1,37 @@
|
||||
### STAGE 1: Build ###
|
||||
FROM node:9.11.1-alpine as builder
|
||||
ARG branch=develop
|
||||
ENV BRANCH=$branch
|
||||
WORKDIR /src/app
|
||||
RUN mkdir -p /src/app/coriolis
|
||||
RUN mkdir -p /src/app/coriolis-data
|
||||
|
||||
COPY ./coriolis/ /src/app/coriolis
|
||||
COPY ./coriolis-data/ /src/app/coriolis-data
|
||||
|
||||
RUN apk update
|
||||
RUN apk add git
|
||||
|
||||
RUN npm i -g npm
|
||||
|
||||
# Set up coriolis-data
|
||||
WORKDIR /src/app/coriolis-data
|
||||
RUN git fetch --all
|
||||
RUN git reset --hard origin/$BRANCH
|
||||
RUN npm install --no-package-lock
|
||||
RUN npm start
|
||||
|
||||
WORKDIR /src/app/coriolis
|
||||
RUN git fetch --all
|
||||
RUN git reset --hard origin/$BRANCH
|
||||
RUN rm -rf node_modules/
|
||||
RUN npm install --no-package-lock
|
||||
RUN npm run build
|
||||
|
||||
|
||||
### STAGE 2: Production Environment ###
|
||||
FROM nginx:1.13.12-alpine as web
|
||||
COPY nginx.conf /etc/nginx/nginx.conf
|
||||
COPY --from=builder /src/app/coriolis/build /usr/share/nginx/html
|
||||
EXPOSE 80
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
39
.docker/docker-compose.yml
Normal file
39
.docker/docker-compose.yml
Normal file
@@ -0,0 +1,39 @@
|
||||
version: '2.2'
|
||||
|
||||
services:
|
||||
coriolis_prod:
|
||||
build:
|
||||
dockerfile: coriolis/.docker/Dockerfile
|
||||
context: ../..
|
||||
environment:
|
||||
BRANCH: master
|
||||
restart: always
|
||||
networks:
|
||||
- coriolis_web
|
||||
- default
|
||||
labels:
|
||||
- "traefik.docker.network=coriolis_coriolis_web"
|
||||
- "traefik.enable=true"
|
||||
- "traefik.basic.frontend.rule=Host:coriolis.io,coriolis.edcd.io"
|
||||
- "traefik.basic.port=80"
|
||||
- "traefik.basic.protocol=http"
|
||||
|
||||
coriolis_dev:
|
||||
build:
|
||||
dockerfile: coriolis/.docker/Dockerfile
|
||||
context: ../..
|
||||
restart: always
|
||||
environment:
|
||||
BRANCH: feature/docker-deployment
|
||||
networks:
|
||||
- coriolis_web
|
||||
- default
|
||||
labels:
|
||||
- "traefik.docker.network=coriolis_coriolis_web"
|
||||
- "traefik.enable=true"
|
||||
- "traefik.basic.frontend.rule=Host:beta.coriolis.io,beta.coriolis.edcd.io"
|
||||
- "traefik.basic.port=80"
|
||||
- "traefik.basic.protocol=http"
|
||||
|
||||
networks:
|
||||
coriolis_web:
|
||||
38
.docker/nginx.conf
Normal file
38
.docker/nginx.conf
Normal file
@@ -0,0 +1,38 @@
|
||||
user nobody;
|
||||
worker_processes auto; # it will be determinate automatically by the number of core
|
||||
|
||||
error_log /var/log/nginx/error.log warn;
|
||||
#pid /var/run/nginx.pid; # it permit you to use /etc/init.d/nginx reload|restart|stop|start
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
http {
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
sendfile on;
|
||||
access_log /var/log/nginx/access.log;
|
||||
keepalive_timeout 3000;
|
||||
server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
|
||||
index index.html;
|
||||
|
||||
server_name localhost;
|
||||
root /src/app/coriolis/build;
|
||||
|
||||
location ~* \.(?:manifest|appcache|html?|xml|json|css|js|map|jpg|jpeg|gif|png|ico|svg|eot|ttf|woff|woff2)$ {
|
||||
expires -1;
|
||||
add_header Access-Control-Allow-Origin *;
|
||||
add_header Access-Control-Allow-Credentials true;
|
||||
add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS';
|
||||
add_header Access-Control-Allow-Headers 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
|
||||
access_log off;
|
||||
}
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html =404;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user