2
0
mirror of https://github.com/offen/website.git synced 2024-11-22 09:00:28 +01:00

add dockerized deployment build

This commit is contained in:
Frederik Ring 2019-09-04 20:50:53 +02:00
parent 907736a6e2
commit b2fe172681
3 changed files with 96 additions and 0 deletions

16
build/docker-compose.yml Normal file
View File

@ -0,0 +1,16 @@
version: '3'
services:
proxy:
build:
context: './..'
dockerfile: build/proxy/Dockerfile
ports:
- 3000:80
depends_on:
- server
server:
build:
context: './..'
dockerfile: build/server/Dockerfile

58
build/proxy/Dockerfile Normal file
View File

@ -0,0 +1,58 @@
FROM node:10 as auditorium
COPY ./auditorium /code/auditorium
COPY ./packages /code/packages
COPY ./styles /code/styles
COPY ./banner.txt /code/banner.txt
WORKDIR /code/auditorium
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true
RUN npm install
ENV NODE_ENV production
RUN npm run build
FROM node:10 as script
COPY ./script /code/script
COPY ./packages /code/packages
COPY ./banner.txt /code/banner.txt
WORKDIR /code/script
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true
RUN npm install
ENV NODE_ENV production
RUN npm run build
FROM node:10 as vault
COPY ./vault /code/vault
COPY ./packages /code/packages
COPY ./banner.txt /code/banner.txt
WORKDIR /code/vault
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true
RUN npm install
ENV NODE_ENV production
RUN npm run build
FROM nikolaik/python-nodejs:python3.6-nodejs10 as homepage
COPY ./homepage /code/homepage
COPY ./styles /code/styles
RUN npm install svgo -g
RUN apt-get update \
&& apt-get install -y libjpeg-progs optipng \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /code/homepage
ENV PATH /root/.local/bin:$PATH
RUN pip install --user -r requirements.txt
RUN make publish
FROM nginx:1.17-alpine
COPY --from=homepage /code/homepage/output /www/data
COPY --from=auditorium /code/auditorium/dist /www/data/auditorium
COPY --from=script /code/script/dist /www/data/script
COPY --from=vault /code/vault/dist /www/data/vault
COPY ./build/proxy/nginx.conf /etc/nginx/nginx.conf
EXPOSE 80

22
build/proxy/nginx.conf Normal file
View File

@ -0,0 +1,22 @@
events {}
http {
include /etc/nginx/mime.types;
upstream server {
server server:3000;
}
server {
listen 80;
autoindex on;
root /www/data;
location /api/ {
proxy_pass http://server;
proxy_redirect off;
rewrite ^/api(.*)$ $1 break;
}
}
}