Skip to content
Snippets Groups Projects
Commit 43f07e5b authored by Matthieu Benoist's avatar Matthieu Benoist
Browse files

Add ci/cd and dev env

parent 75fd6f1e
Branches main
No related tags found
No related merge requests found
PROJECT_NAME=auto-evaluation
PROJECT_HOSTNAME=autoeval.grandlyon.localhost
CERT_SIZE=1
......@@ -37,7 +37,7 @@ package-lock.json
/libpeerconnection.log
testem.log
/typings
/.env
# System files
.DS_Store
Thumbs.db
image: node:20
stages:
- build
- release
# Build job
build:
stage: build
script:
- npm install # install deps
- npm run build # Compile
artifacts:
paths:
- dist/ # we save the compiled files in an artefact
expire_in: 1 day
only:
- tags # triggered with tag
# Release job
release:
stage: release
needs: [build]
image: registry.gitlab.com/gitlab-org/release-cli:latest
script:
- echo "Création de la release pour le tag $CI_COMMIT_TAG"
release:
tag_name: $CI_COMMIT_TAG
name: "Release $CI_COMMIT_TAG"
description: "Release générée automatiquement pour le tag $CI_COMMIT_TAG"
assets:
links:
- name: "Télécharger la version compilée"
url: "${CI_PROJECT_URL}/-/jobs/artifacts/${CI_COMMIT_TAG}/download?job=build"
only:
- tags
Makefile 0 → 100644
ifneq (,$(wildcard ./.env))
include .env
endif
.PHONY: config
config:
cp .env.example .env
# Docker
up:
docker compose up -d
down:
docker compose down
ps:
docker compose ps
rebuild:
docker compose down --remove-orphans
docker compose build --no-cache
docker compose up -d
# Mkcert
define config_toml
[[tls.certificates]]
certFile = "/certs/${PROJECT_HOSTNAME}+${CERT_SIZE}.pem"
keyFile = "/certs/${PROJECT_HOSTNAME}+${CERT_SIZE}-key.pem"
endef
export config_toml
npm-install:
docker compose run --rm node npm install
certs:
mkdir -p ${HOME}/.dockerdev/traefik/certs ${HOME}/.dockerdev/traefik/conf
mkcert ${PROJECT_HOSTNAME} *.${PROJECT_HOSTNAME} ${CERT_ALIASES}
mv *.pem ~/.dockerdev/traefik/certs
@echo "$$config_toml" > ~/.dockerdev/traefik/conf/${PROJECT_NAME}-certs.toml
install: config certs up
services:
node:
image: trion/ng-cli:17.2.1
restart: unless-stopped
volumes:
- ./:/app
working_dir: /app
command: ng serve --host 0.0.0.0 --port 4200
networks:
- webgateway
labels:
- "traefik.enable=true"
- "traefik.http.routers.${PROJECT_NAME}-front.rule=Host(`${PROJECT_HOSTNAME}`)"
- "traefik.http.routers.${PROJECT_NAME}-front.tls=true"
- "traefik.http.routers.${PROJECT_NAME}-front.entrypoints=websecure"
- "traefik.http.services.${PROJECT_NAME}-front.loadbalancer.server.port=4200"
networks:
webgateway:
external: true
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment