Compare commits

..
19 Commits
Author SHA1 Message Date
marc eaea9577ea home is back instead of opt 2022-09-24 20:11:10 +02:00
marc ca176b628a entrypoint for prod is a must 2022-09-21 16:49:20 +02:00
marc fc7a469181 apache2-foreground 2022-09-21 16:40:56 +02:00
marc decd443031 rip exec 2022-09-21 16:30:23 +02:00
marc 6ee3e34d0c forcing every command 2022-09-20 15:38:58 +02:00
marc d2ca350fd4 executable 2022-09-20 15:37:34 +02:00
marc ddf8132963 absolute path 2022-09-20 15:35:54 +02:00
marc 7e14892de1 overloading entrypoint 2022-09-20 15:33:56 +02:00
marc fb944657b5 dockerfile 2022-09-19 10:57:56 +02:00
marc 07dbb05443 opt 2022-09-16 19:30:39 +02:00
marc d18074c556 Merge branch 'docker-compose' into php7.4 2022-09-16 19:16:17 +02:00
marc a6b9888cfe production 2022-09-16 19:06:08 +02:00
marc 6d40239a13 Merge branch 'back-dockerfile-clean' into php7.4 2022-09-16 18:47:05 +02:00
marc 57fb4d7639 clean dev 2022-09-16 18:46:53 +02:00
marc 36ea133390 clean production 2022-09-16 18:46:21 +02:00
marc 9f28d25eb7 production too 2022-09-16 18:43:47 +02:00
marc 8f69143715 3.9 2022-09-16 18:43:11 +02:00
marc 739212ea0a update to php7.4 - build ok 2022-09-16 18:39:19 +02:00
marc c64058fff0 update of composer 2022-09-15 16:45:37 +02:00
20 changed files with 12924 additions and 9327 deletions
+1 -3
View File
@@ -4,8 +4,6 @@
.vscode
.DS_Store
docker-compose*.yml
.env
.env.template
# Back
back/.DS_Store
@@ -19,4 +17,4 @@ var
# Front
front/.DS_Store
front/node_modules/
front/dist/
front/dist/
-48
View File
@@ -1,48 +0,0 @@
name: Docker build test
on:
push:
branches:
- "*"
- "!master"
# Publish `v1.2.3` tags as releases.
tags:
- v*
# Run tests for any PRs.
pull_request:
jobs:
build-back:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Fake env file
run: touch .env
- name: Build
run: docker-compose -f docker-compose.production.yml build back
build-front:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Fake env file
run: touch .env
- name: Build
run: docker-compose -f docker-compose.production.yml build front
-89
View File
@@ -1,89 +0,0 @@
name: Docker
on:
schedule:
- cron: "0 4 * * 0" # run every sunday at 4 am to test if the image builds correctly given that changes of debian or compose packages can break the image
push:
branches:
- "master"
# Publish `v1.2.3` tags as releases.
tags:
- v*
# Run tests for any PRs.
pull_request:
jobs:
build-front:
name: Build front
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push front
uses: docker/build-push-action@v3
with:
context: front
dockerfile: Dockerfile
push: true
tags: numerisisep/numeris-front:latest
build-back:
name: Build back
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push back
uses: docker/build-push-action@v3
with:
context: back
dockerfile: Dockerfile.production
push: true
tags: numerisisep/numeris-back:latest
pull-and-recreate:
name: Pull and recreate
needs:
- build-front
- build-back
runs-on: ubuntu-latest
steps:
- name: executing remote ssh commands using password
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
# password: ${{ secrets.PASSWORD }}
key: ${{ secrets.KEY }}
port: ${{ secrets.PORT }}
script: |
cd numeris
git pull
docker-compose -f docker-compose.production.yml pull
docker-compose -f docker-compose.production.yml up -d --force-recreate
-2
View File
@@ -2,5 +2,3 @@
vendor
public/storage
public/build
.env
.env.template
+1 -5
View File
@@ -17,11 +17,7 @@ RUN docker-php-ext-install pdo_mysql gd zip
COPY --from=composer /usr/bin/composer /usr/bin/composer
# Enable apache conf
COPY docker/apache/numeris.conf /etc/apache2/sites-available/numeris.conf
RUN a2dissite 000-default.conf && \
a2ensite numeris.conf && \
a2enmod headers && \
a2enmod rewrite && \
service apache2 restart
RUN a2dissite 000-default.conf && a2ensite numeris.conf && a2enmod rewrite && service apache2 restart
# Enable php conf
COPY docker/php/php.ini /usr/local/etc/php/conf.d/default.ini
+1 -5
View File
@@ -15,11 +15,7 @@ RUN docker-php-ext-install pdo_mysql gd zip
COPY --from=composer /usr/bin/composer /usr/bin/composer
# Enable apache conf
COPY docker/apache/numeris.conf /etc/apache2/sites-available/numeris.conf
RUN a2dissite 000-default.conf && \
a2ensite numeris.conf && \
a2enmod headers && \
a2enmod rewrite && \
service apache2 restart
RUN a2dissite 000-default.conf && a2ensite numeris.conf && a2enmod rewrite && service apache2 restart
# Enable php conf
COPY docker/php/php.ini /usr/local/etc/php/conf.d/default.ini
+3 -11
View File
@@ -1,11 +1,7 @@
{
"name": "2seg/numeris-v2",
"description": "Home of the new website of Numéris.",
"keywords": [
"Numéris",
"association",
"website"
],
"keywords": ["Numéris", "association", "website"],
"license": "MIT",
"type": "project",
"authors": [
@@ -18,11 +14,6 @@
"name": "MinhNam Nguyen",
"email": "nguyen.minhnam@hotmail.fr",
"role": "Developer"
},
{
"name": "Marc Partensky",
"email": "marc@marcpartensky.com",
"role": "Developer"
}
],
"require": {
@@ -60,7 +51,8 @@
},
"extra": {
"laravel": {
"dont-discover": []
"dont-discover": [
]
}
},
"scripts": {
+2 -5
View File
@@ -6,13 +6,10 @@
# Force HTTPS when X-Forwarded-Proto is passed as HTTPS
# Useful when the reverse proxy is in HTTPS
SetEnvIf x-forwarded-proto https HTTPS=on
# Header set Access-Control-Allow-Origin "*"
# Header set Access-Control-Allow-Origin "numeris-isep.fr"
Header set Access-Control-Allow-Origin "https://numeris-isep.fr"
AllowOverride All
Require all granted
</Directory>
ErrorLog /var/log/apache2/error.log
CustomLog /var/log/apache2/access.log combined
ErrorLog /var/log/apache2/numeris-error.log
CustomLog /var/log/apache2/numeris-access.log combined
</VirtualHost>
+3 -7
View File
@@ -1,12 +1,8 @@
#!/usr/bin/env sh
php artisan key:generate
# php artisan key:generate --force
php artisan jwt:secret
# php artisan jwt:secret --force
# php artisan cache:clear
php artisan config:clear
php artisan migrate:refresh
php artisan key:generate --force
php artisan jwt:secret --force
php artisan migrate:refresh --seed --force
docker-php-entrypoint
apache2-foreground
+5 -64
View File
@@ -3,7 +3,6 @@ services:
phpmyadmin:
image: phpmyadmin/phpmyadmin:latest
container_name: numeris_phpmyadmin
restart: unless-stopped
ports:
- 3000:80
@@ -11,83 +10,25 @@ services:
- 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
ports:
- 127.0.0.1:3306:3306
env_file:
- .env
volumes:
- ./var/mysql:/var/lib/mysql
# - /var/run/mysqld:/var/run/mysqld
- mysql:/var/lib/mysql
back:
image: numerisisep/numeris-back
container_name: numeris_back
restart: unless-stopped
build:
context: ./back
dockerfile: Dockerfile.production
networks:
- caddy
- mysql
dockerfile: Dockerfile
env_file:
- .env
volumes:
- .env:/home/numeris/.env
links:
- mysql
depends_on:
- mysql
labels:
caddy: api.numeris-isep.fr
caddy.reverse_proxy: "{{upstreams 80}}"
# caddy.reverse_proxy.header_down: -Access-Control-Allow-Origin
front:
image: numerisisep/numeris-front
container_name: numeris_front
build:
context: ./front
dockerfile: Dockerfile.production
networks:
- caddy
labels:
caddy: numeris-isep.fr
caddy.reverse_proxy: "{{upstreams 80}}"
caddy:
image: lucaslorentz/caddy-docker-proxy:ci-alpine
restart: unless-stopped
environment:
CADDY_INGRESS_NETWORKS: caddy
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:
- mysql
volumes:
caddy_data:
mysql:
-90
View File
@@ -1,90 +0,0 @@
version: "3.9"
services:
phpmyadmin:
image: phpmyadmin/phpmyadmin:latest
container_name: numeris_phpmyadmin
restart: unless-stopped
ports:
- 3000:80
links:
- mysql:db
depends_on:
- mysql
networks:
- caddy
- mysql
labels:
caddy: phpmyadmin.staging.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:
# - ./var/mysql:/var/lib/mysql
back:
image: numerisisep/numeris-back
container_name: numeris_back
restart: unless-stopped
build:
context: ./back
dockerfile: Dockerfile.production
networks:
- caddy
- mysql
env_file:
- .env
volumes:
- .env:/home/numeris/.env
depends_on:
- mysql
labels:
caddy: api.staging.numeris-isep.fr
caddy.reverse_proxy: "{{upstreams 80}}"
# caddy.reverse_proxy.header_down: -Access-Control-Allow-Origin
front:
image: numerisisep/numeris-front
container_name: numeris_front
build:
context: ./front
dockerfile: Dockerfile.production
networks:
- caddy
labels:
caddy: staging.numeris-isep.fr
caddy.reverse_proxy: "{{upstreams 80}}"
# caddy:
# image: lucaslorentz/caddy-docker-proxy:ci-alpine
# restart: unless-stopped
# environment:
# CADDY_INGRESS_NETWORKS: caddy
# 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:
caddy_data:
mysql:
+28
View File
@@ -0,0 +1,28 @@
version: '3'
services:
mysql:
image: mysql:5.7
environment:
MYSQL_DATABASE: 'numeris_testing'
MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
container_name: numeris_mysql
back:
build:
context: ./back
dockerfile: Dockerfile
environment:
DB_CONNECTION: testing
DB_HOST_TESTING: mysql
DB_PORT_TESTING: 3306
DB_DATABASE_TESTING: numeris_testing
DB_USERNAME_TESTING: root
DB_PASSWORD_TESTING:
ports:
- 8080:80
links:
- mysql
depends_on:
- mysql
container_name: numeris_back
+2
View File
@@ -50,6 +50,8 @@ services:
- /home/numeris/node_modules
links:
- back
expose:
- ${FRONT_PORT}
ports:
- ${FRONT_PORT}:${FRONT_PORT}
command: ng s --host 0.0.0.0
-1
View File
@@ -1,4 +1,3 @@
.DS_Store
node_modules/
dist/
Dockerfile
+15 -8
View File
@@ -1,9 +1,16 @@
FROM node:11.15.0 as builder
WORKDIR /opt/numeris
ENV PATH /opt/numeris/node_modules/.bin:$PATH
COPY package.json yarn.lock /opt/numeris/
RUN yarn install
# RUN yarn add -g @angular/cli@7.3.9
FROM node:11.15.0
WORKDIR /home/numeris
ENV PATH /home/numeris/node_modules/.bin:$PATH
COPY package*.json /home/numeris/
# npm install
RUN npm install
RUN npm install -g @angular/cli@7.3.9
COPY . .
RUN yarn run build-prod
ENTRYPOINT [ "ng", "serve", "--port", "80" ]
RUN npm rebuild node-sass
ENTRYPOINT [ "ng", "s", "--host", "0.0.0.0" ]
-17
View File
@@ -1,17 +0,0 @@
FROM node:11.15.0 as builder
WORKDIR /opt/numeris
ENV PATH /opt/numeris/node_modules/.bin:$PATH
COPY package.json /opt/numeris/
COPY yarn.lock /opt/numeris/
RUN yarn install
# RUN yarn add -g @angular/cli@7.3.9
COPY . .
RUN yarn run build-prod
ENTRYPOINT [ "ng", "serve", "--configuration", "production", "--port", "80" ]
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;"]
-14
View File
@@ -1,14 +0,0 @@
server {
gzip on;
gzip_types text/plain text/css application/javascript;
gzip_proxied no-cache no-store private expired auth;
gzip_min_length 1000;
listen 80;
server_name 0.0.0.0;
root /usr/share/nginx/html;
index index.html;
location / {
try_files $uri $uri/ /index.html;
}
}
+12862
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -60,6 +60,6 @@
"protractor": "~5.4.2",
"ts-node": "~8.0.3",
"tslint": "~5.14.0",
"typescript": "3.1.1"
"typescript": "^3.2.4"
}
}
-8957
View File
File diff suppressed because it is too large Load Diff