Compare commits

..
Author SHA1 Message Date
marc 80aa16c844 new ports 2022-09-21 16:25:45 +02:00
marc 51eeb3d000 Merge remote-tracking branch 'origin/docker-compose' into front-multistage 2022-09-21 16:20:32 +02:00
marc 08f70a7a61 ci 2022-09-21 11:03:09 +02:00
marc e844eafd41 opt/numeris 2022-09-21 10:40:50 +02:00
marc def2fc0335 nginx.conf 2022-09-21 10:37:25 +02:00
marc ec4a85ecbe nginx 2022-09-21 10:36:47 +02:00
marc 694f0b0d25 multistage 2022-09-21 10:32:33 +02:00
marc 6533ab3b30 entrypoint is front is a must 2022-09-19 10:59:19 +02:00
4 changed files with 38 additions and 56 deletions
+3 -37
View File
@@ -7,21 +7,15 @@ services:
restart: unless-stopped
ports:
- 3000:80
links:
- mysql:db
depends_on:
- mysql
networks:
- caddy
- mysql
labels:
caddy: phpmyadmin.numeris-isep.fr
caddy.reverse_proxy: "{{upstreams 80}}"
mysql:
image: mysql:5.7
container_name: numeris_mysql
restart: unless-stopped
networks:
- mysql
env_file:
- .env
volumes:
@@ -32,10 +26,7 @@ services:
restart: unless-stopped
build:
context: ./back
dockerfile: Dockerfile.production
networks:
- caddy
- mysql
dockerfile: Dockerfile
env_file:
- .env
depends_on:
@@ -46,33 +37,8 @@ services:
build:
context: ./front
dockerfile: Dockerfile
networks:
- caddy
depends_on:
- back
labels:
caddy: numeris-isep.fr
caddy.reverse_proxy: "{{upstreams 4200}}"
caddy:
image: lucaslorentz/caddy-docker-proxy:ci-alpine
restart: unless-stopped
ports:
- "80:80"
- "443:443"
volumes:
# docker rootless daemon socket https://docs.docker.com/engine/security/rootless/
- /var/run/docker.sock:/var/run/docker.sock
- caddy_data:/data
networks:
- caddy
healthcheck:
test: ["CMD", "curl", "-f", "localhost:80"]
networks:
caddy:
external: true
mysql:
volumes:
mysql:
+2 -4
View File
@@ -1,4 +1,4 @@
version: "3.9"
version: '3'
services:
phpmyadmin:
@@ -21,7 +21,6 @@ services:
MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
back:
image: numeris-back
container_name: numeris_back
build:
context: ./back
@@ -41,13 +40,12 @@ services:
- mysql
front:
image: numeris-front
container_name: numeris_front
build:
context: ./front
dockerfile: Dockerfile
ports:
- 4200:4200
- 8000:80
links:
- back
depends_on:
+14 -15
View File
@@ -1,18 +1,17 @@
FROM node:11.15.0
RUN mkdir -p /home/numeris
ENV PATH /home/numeris/node_modules/.bin:$PATH
COPY package*.json /home/numeris/
# npm install
WORKDIR /home/numeris
RUN npm install
FROM node:11.15.0 as builder
WORKDIR /opt/numeris
ENV PATH /opt/numeris/node_modules/.bin:$PATH
COPY package*.json /opt/numeris/
RUN npm ci
RUN npm install -g @angular/cli@7.3.9
COPY . /home/numeris
COPY . .
RUN npm rebuild node-sass
RUN npm run build-prod
ENTRYPOINT [ "ng", "s", "--host", "0.0.0.0" ]
WORKDIR /home/numeris
FROM nginx
COPY nginx.conf /etc/nginx/conf.d/default.conf
RUN rm -rf /usr/share/nginx/html/*
COPY --from=builder /opt/numeris/dist /usr/share/nginx/html
EXPOSE 80
ENTRYPOINT ["nginx", "-g", "daemon off;"]
+19
View File
@@ -0,0 +1,19 @@
server {
listen 80;
sendfile on;
default_type application/octet-stream;
gzip on;
gzip_http_version 1.1;
gzip_disable "MSIE [1-6]\.";
gzip_min_length 1100;
gzip_vary on;
gzip_proxied expired no-cache no-store private auth;
gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript;
gzip_comp_level 9;
root /usr/share/nginx/html;
location / {
try_files $uri $uri/ /index.html =404;
}
}