Compare commits

..
8 changed files with 30 additions and 147 deletions
+1 -2
View File
@@ -4,7 +4,6 @@
.vscode
.DS_Store
docker-compose*.yml
.env*
# Back
back/.DS_Store
@@ -18,4 +17,4 @@ var
# Front
front/.DS_Store
front/node_modules/
front/dist/
front/dist/
+2 -4
View File
@@ -21,7 +21,7 @@ RUN a2dissite 000-default.conf && a2ensite numeris.conf && a2enmod rewrite && se
# Enable php conf
COPY docker/php/php.ini /usr/local/etc/php/conf.d/default.ini
WORKDIR /home/numeris
WORKDIR /opt/numeris
COPY . .
# Composer install
@@ -31,7 +31,5 @@ RUN composer install --no-interaction
RUN apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN usermod -u 1000 www-data
RUN chown -R www-data:www-data /home/numeris
RUN chown -R www-data:www-data /opt/numeris
RUN chown -R www-data:www-data /var/log/apache2/
ENTRYPOINT [ "/home/numeris/entrypoint.sh" ]
+2 -4
View File
@@ -19,7 +19,7 @@ RUN a2dissite 000-default.conf && a2ensite numeris.conf && a2enmod rewrite && se
# Enable php conf
COPY docker/php/php.ini /usr/local/etc/php/conf.d/default.ini
WORKDIR /home/numeris
WORKDIR /opt/numeris
COPY . .
### Back config ###
@@ -29,10 +29,8 @@ RUN composer install --optimize-autoloader --no-dev --no-interaction
RUN apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN usermod -u 1000 www-data
RUN chown -R www-data:www-data /home/numeris
RUN chown -R www-data:www-data /opt/numeris
RUN chown -R www-data:www-data /var/log/apache2/
RUN php artisan config:cache
RUN php artisan route:cache
ENTRYPOINT [ "/home/numeris/entrypoint.sh" ]
-8
View File
@@ -1,8 +0,0 @@
#!/usr/bin/env sh
php artisan key:generate --force
php artisan jwt:secret --force
php artisan migrate:refresh --seed --force
docker-php-entrypoint
apache2-foreground
+6 -84
View File
@@ -3,117 +3,39 @@ services:
phpmyadmin:
image: phpmyadmin/phpmyadmin:latest
container_name: numeris_phpmyadmin
restart: unless-stopped
ports:
- 3000:80
links:
- mysql:db
depends_on:
- mysql
networks:
- traefik
- mysql
labels:
traefik.enable: "true"
traefik.http.routers.phpmyadmin.rule: Host(`phpmyadmin.numeris-isep.fr`)
traefik.http.routers.phpmyadmin.entrypoints: websecure
traefik.http.routers.phpmyadmin.tls.certresolver: zerossl
traefik.http.services.phpmyadmin.loadbalancer.server.port: 80
mysql:
image: mysql:5.7
container_name: numeris_mysql
restart: unless-stopped
networks:
- mysql
env_file:
- .env
volumes:
- ./var/mysql:/var/lib/mysql
- mysql:/var/lib/mysql
back:
container_name: numeris_back
restart: unless-stopped
build:
context: ./back
dockerfile: Dockerfile.production
networks:
- traefik
- mysql
dockerfile: Dockerfile
env_file:
- .env
depends_on:
- mysql
labels:
traefik.enable: "true"
traefik.http.routers.back.rule: Host(`api.numeris-isep.fr`)
traefik.http.routers.back.entrypoints: websecure
traefik.http.routers.back.tls.certresolver: zerossl
traefik.http.services.back.loadbalancer.server.port: 80
- mysql
front:
container_name: numeris_front
build:
context: ./front
dockerfile: Dockerfile
networks:
- traefik
depends_on:
- back
labels:
traefik.enable: "true"
traefik.http.routers.front.rule: Host(`numeris-isep.fr`)
traefik.http.routers.front.entrypoints: websecure
traefik.http.routers.front.tls.certresolver: zerossl
traefik.http.services.front.loadbalancer.server.port: 80
traefik:
image: traefik
restart: unless-stopped
command:
# ## Provider Settings - https://docs.traefik.io/providers/docker/#provider-configuration ##
# # - --providers.docker.exposedbydefault=false # <== Don't expose every container to traefik, only expose enabled ones
# - --providers.file.filename=/dynamic.yaml # <== Referring to a dynamic configuration file
- --providers.docker.network=web # <== Operate on the docker network named web
- --providers.docker=true # <== Enabling docker as the provider for traefik
# ## API Settings - https://docs.traefik.io/operations/api/, endpoints - https://docs.traefik.io/operations/api/#endpoints ##
# - --api.insecure=false # <== Enabling insecure api, NOT RECOMMENDED FOR PRODUCTION
- --api.dashboard=true
- --api.debug=true # <== Enabling additional endpoints for debugging and profiling
# ## Entrypoints Settings - https://docs.traefik.io/routing/entrypoints/#configuration ##
- --entrypoints.web.address=:80
- --entrypoints.websecure.address=:443
# - --certificatesresolvers.tls.acme.email = support@numeris-isep.fr
# - --certificatesresolvers.tls.acme.tlschallenge=true # <== Enable TLS-ALPN-01 to generate and renew ACME certs - --certificatesresolvers.tls.acme.email=marc.partensky@gmail.com
# - --certificatesresolvers.tls.acme.storage=/letsencrypt/acme.json # Log Settings (options: ERROR, DEBUG, PANIC, FATAL, WARN, INFO) - https://docs.traefik.io/observability/logs/ ##
- --certificatesresolvers.zerossl.acme.email=support@numeris-isep.fr
- --certificatesresolvers.zerossl.acme.tlschallenge=true # <== Enable TLS-ALPN-01 to generate and renew ACME certs - --certificatesresolvers.tls.acme.email=marc.partensky@gmail.com
- --certificatesresolvers.zerossl.acme.storage=/zerossl/acme.json # Log Settings (options: ERROR, DEBUG, PANIC, FATAL, WARN, INFO) - https://docs.traefik.io/observability/logs/ ##
- --log.level=DEBUG # <== Setting the level of the logs from traefik
- --entrypoints.web.http.redirections.entryPoint.to=websecure
- --entrypoints.web.http.redirections.entryPoint.scheme=https
- --entrypoints.web.http.redirections.entrypoint.permanent=true
ports:
- "80:80"
- "443:443"
networks:
- traefik
volumes:
# - ./traefik.yml:/traefik.yml # static configuration
# - ./dynamic.yml:/dynamic.yml
- traefik_letsencrypt:/letsencrypt
- /var/run/docker.sock:/var/run/docker.sock:ro
labels:
traefik.enable: "true"
traefik.http.routers.traefik.rule: Host(`traefik.numeris-isep.fr`)
traefik.http.routers.traefik.service: api@internal
traefik.http.routers.traefik.entrypoints: websecure
traefik.http.routers.traefik.tls.certresolver: zerossl
traefik.docker.network: traefik
networks:
traefik:
mysql:
entrypoint: ng s --host 0.0.0.0
volumes:
traefik_letsencrypt:
mysql:
+2 -10
View File
@@ -1,31 +1,25 @@
version: "3.9"
version: '3'
services:
phpmyadmin:
image: phpmyadmin/phpmyadmin:latest
container_name: numeris_phpmyadmin
restart: unless-stopped
ports:
- 3000:80
links:
- mysql:db
depends_on:
- mysql
volumes:
- ./var/mysql_testing:/var/lib/mysql
mysql:
image: mysql:5.7
container_name: numeris_mysql
restart: unless-stopped
environment:
MYSQL_DATABASE: 'numeris_testing'
MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
back:
image: numeris-back
container_name: numeris_back
restart: unless-stopped
build:
context: ./back
dockerfile: Dockerfile
@@ -44,14 +38,12 @@ services:
- mysql
front:
image: numeris-front
container_name: numeris_front
restart: unless-stopped
build:
context: ./front
dockerfile: Dockerfile
ports:
- 8000:80
- 4200:4200
links:
- back
depends_on:
+17 -16
View File
@@ -1,17 +1,18 @@
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 . .
RUN npm rebuild node-sass
RUN npm run build-prod
ENTRYPOINT [ "ng", "s", "--host", "0.0.0.0" ]
FROM node:11.15.0
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;"]
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
RUN npm install -g @angular/cli@7.3.9
COPY . /home/numeris
RUN npm rebuild node-sass
WORKDIR /home/numeris
-19
View File
@@ -1,19 +0,0 @@
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;
}
}