Compare commits
4 Commits
updatedNgi
...
Etape1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8c49e7b6ee | ||
|
|
f34f5719fd | ||
|
|
3684a3513d | ||
|
|
bfc2253a27 |
@@ -16,10 +16,6 @@ services:
|
|||||||
build:
|
build:
|
||||||
context: ..
|
context: ..
|
||||||
dockerfile: dockerfiles/front/Dockerfile
|
dockerfile: dockerfiles/front/Dockerfile
|
||||||
|
|
||||||
ports:
|
|
||||||
- "5000:5000"
|
|
||||||
- "5080:80"
|
|
||||||
volumes:
|
volumes:
|
||||||
- ../doodlestudent/front:/app
|
- ../doodlestudent/front:/app
|
||||||
environment:
|
environment:
|
||||||
|
|||||||
52
gitlab-ci.yml
Normal file
52
gitlab-ci.yml
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
stages:
|
||||||
|
- check
|
||||||
|
- build
|
||||||
|
- deploy
|
||||||
|
|
||||||
|
variables:
|
||||||
|
APP_REPO: "https://github.com/barais/doodlestudent.git"
|
||||||
|
SUBMODULE_PATH: "doodlestudent"
|
||||||
|
|
||||||
|
check_app_update:
|
||||||
|
stage: check
|
||||||
|
image: alpine:latest
|
||||||
|
before_script:
|
||||||
|
- apk add --no-cache git
|
||||||
|
script:
|
||||||
|
# Récupère le dernier commit distant
|
||||||
|
- LATEST_REMOTE=$(git ls-remote $APP_REPO HEAD | awk '{print $1}')
|
||||||
|
# Récupère le commit actuel du submodule
|
||||||
|
- CURRENT_SUBMODULE=$(git rev-parse HEAD:$SUBMODULE_PATH || echo "none")
|
||||||
|
- echo "Remote: $LATEST_REMOTE"
|
||||||
|
- echo "Current: $CURRENT_SUBMODULE"
|
||||||
|
|
||||||
|
# Compare
|
||||||
|
- |
|
||||||
|
if [ "$LATEST_REMOTE" != "$CURRENT_SUBMODULE" ]; then
|
||||||
|
echo "NEW_COMMIT=true" >> variables.env
|
||||||
|
else
|
||||||
|
echo "NEW_COMMIT=false" >> variables.env
|
||||||
|
fi
|
||||||
|
artifacts:
|
||||||
|
reports:
|
||||||
|
dotenv: variables.env
|
||||||
|
|
||||||
|
build_image:
|
||||||
|
stage: build
|
||||||
|
image: docker:latest
|
||||||
|
services:
|
||||||
|
- docker:dind
|
||||||
|
rules:
|
||||||
|
- if: '$NEW_COMMIT == "true"'
|
||||||
|
script:
|
||||||
|
- git submodule update --init --remote
|
||||||
|
- docker build -t myapp:latest .
|
||||||
|
- docker push myapp:latest
|
||||||
|
|
||||||
|
deploy:
|
||||||
|
stage: deploy
|
||||||
|
rules:
|
||||||
|
- if: '$NEW_COMMIT == "true"'
|
||||||
|
script:
|
||||||
|
- echo "Deploying..."
|
||||||
|
- docker compose up -f dockercompose/docker-compose.yml -d
|
||||||
28
nginx.conf
28
nginx.conf
@@ -1,7 +1,9 @@
|
|||||||
server {
|
server {
|
||||||
listen 80;
|
listen 443 ssl;
|
||||||
server_name _;
|
server_name _;
|
||||||
|
|
||||||
|
ssl_certificate /etc/letsencrypt/live/tondomaine.com/fullchain.pem;
|
||||||
|
ssl_certificate_key /etc/letsencrypt/live/tondomaine.com/privkey.pem;
|
||||||
root /usr/share/nginx/html;
|
root /usr/share/nginx/html;
|
||||||
index index.html;
|
index index.html;
|
||||||
|
|
||||||
@@ -9,16 +11,7 @@ server {
|
|||||||
# Proxy API requests to the back service
|
# Proxy API requests to the back service
|
||||||
##########################
|
##########################
|
||||||
location /api/ {
|
location /api/ {
|
||||||
proxy_pass http://back:8080/;
|
proxy_pass http://back:8080/api/;
|
||||||
proxy_http_version 1.1;
|
|
||||||
proxy_set_header Host $host;
|
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
||||||
proxy_set_header X-Forwarded-Proto $scheme;
|
|
||||||
proxy_set_header Connection "";
|
|
||||||
}
|
|
||||||
location /web/ {
|
|
||||||
proxy_pass http://front:5080/;
|
|
||||||
proxy_http_version 1.1;
|
proxy_http_version 1.1;
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
@@ -39,6 +32,17 @@ server {
|
|||||||
# FrontEnd returns
|
# FrontEnd returns
|
||||||
##########################
|
##########################
|
||||||
location / {
|
location / {
|
||||||
try_files $uri $uri/ /index.html;
|
proxy_pass http://front:80/;
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
proxy_set_header Connection "";
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
server_name tondomaine.com;
|
||||||
|
return 301 https://$host$request_uri;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user