diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 011cd61..d4b4dd7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,2 +1,3 @@ include: - - local: gateway/.gitlab-ci.yml \ No newline at end of file + - local: gateway/.gitlab-ci.yml + - local: web-app/.gitlab-ci.yml \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index e40e7c3..de427aa 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -102,7 +102,7 @@ services: - "traefik.http.services.mqtt-https.loadbalancer.server.port=1883" web-app: - image: web-app:1.0 + image: registry.forge.hefr.ch/team-raclette/project-softweng/web-app:latest container_name: web-app restart: unless-stopped ports: @@ -121,3 +121,5 @@ services: - "traefik.http.routers.web-app-https.rule=Host(`app.mse.kb28.ch`)" - "traefik.http.routers.web-app-https.tls.certResolver=letsencrypt" - "traefik.http.services.web-app-https.loadbalancer.server.port=8080" + + - "com.centurylinklabs.watchtower.enable=true" diff --git a/web-app/.gitlab-ci.yml b/web-app/.gitlab-ci.yml new file mode 100644 index 0000000..d4977c0 --- /dev/null +++ b/web-app/.gitlab-ci.yml @@ -0,0 +1,22 @@ +variables: + DOCKER_IMAGE: registry.forge.hefr.ch/team-raclette/project-softweng/web-app:latest + +default: + image: $DOCKER_IMAGE + +stages: + - build-docker + +docker-build: + image: docker:latest + stage: build-docker + services: + - docker:dind + script: + - docker build -t $DOCKER_IMAGE -f web-app/Dockerfile . + - echo $CI_REGISTRY_PASSWORD | docker login -u $CI_REGISTRY_USER --password-stdin $CI_REGISTRY + - docker push $DOCKER_IMAGE + rules: + - if: $CI_PIPELINE_SOURCE == 'merge_request_event' && $CI_COMMIT_BRANCH == 'main' + - changes: + - web-app/* diff --git a/web-app/Dockerfile b/web-app/Dockerfile index 5be8d06..0d6b2c3 100644 --- a/web-app/Dockerfile +++ b/web-app/Dockerfile @@ -2,7 +2,7 @@ FROM node:22.15-slim WORKDIR /app -COPY . . +COPY ./web-app . RUN npm install