#8 Mise à jour CI/CD
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/pr Build was killed Details

This commit is contained in:
FyloZ 2021-08-05 23:36:48 -04:00
parent a07c72b901
commit 16d1f2afda
Signed by: william
GPG Key ID: 835378AE9AF4AE97
5 changed files with 62 additions and 51 deletions

11
.dockerignore Normal file
View File

@ -0,0 +1,11 @@
.gradle
.idea
**/build
**/data
**/gradle
**/logs
.gitignore
.gitlab-ci.yml
docker-compose.yml
Dockerfile
gradlew**

View File

@ -1,38 +1,51 @@
---
global-variables:
environment: &environment
JAVA_VERSION: 11
GRADLE_VERSION: 7.1
CRE_VERSION: dev-${DRONE_BUILD_NUMBER}
CRE_ARTIFACT_NAME: ColorRecipesExplorer
CRE_REGISTRY_IMAGE: registry.fyloz.dev:5443/colorrecipesexplorer/backend
CRE_PORT: 9101
gradle-image: &gradle-image gradle:7.1-jdk11
alpine-image: &alpine-image alpine:latest
docker-registry-repo: &docker-registry-repo registry.fyloz.dev:5443/colorrecipesexplorer/backend
kind: pipeline
name: default
type: docker
environment:
CRE_VERSION: ${DRONE_BUILD_NUMBER}
CRE_ARTIFACT_NAME: ColorRecipesExplorer
CRE_REGISTRY_IMAGE: registry.fyloz.dev:5443/colorrecipesexplorer/backend
CRE_PORT: 9101
steps:
- name: test
image: gradle:7.1-jdk11
- name: set-docker-tags
image: *alpine-image
environment:
<<: *environment
commands:
- gradle test
- echo -n "latest,dev-$CRE_VERSION" > .tags
- cat .tags
when:
branch: develop
events: push
- name: build
image: gradle:7.1-jdk11
- name: gradle-test
image: *gradle-image
commands:
- gradle bootJar -Pversion=$CRE_VERSION
- mv build/libs/ColorRecipesExplorer-$CRE_VERSION.jar $CRE_ARTIFACT_NAME.jar
- echo -n "latest,$CRE_VERSION" > .tags
- gradle test
when:
branch: master
events: push
branch: develop
events: [push, pull_request]
- name: containerize
image: plugins/docker
environment:
<<: *environment
settings:
build_args:
- JAVA_VERSION=11
repo: registry.fyloz.dev:5443/colorrecipesexplorer/backend
build_args_from_env:
- GRADLE_VERSION
- JAVA_VERSION
- CRE_VERSION
- CRE_PORT
repo: *docker-registry-repo
when:
branch: master
events: push
@ -40,6 +53,8 @@ steps:
- name: deploy
image: alpine:latest
environment:
<<: *environment
CRE_REGISTRY_IMAGE: *docker-registry-repo
DEPLOY_SERVER:
from_secret: deploy_server
DEPLOY_SERVER_USERNAME:
@ -64,7 +79,7 @@ steps:
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
- ssh -p $DEPLOY_SERVER_SSH_PORT $DEPLOY_SERVER_USERNAME@$DEPLOY_SERVER "docker stop $DEPLOY_CONTAINER_NAME || true && docker rm $DEPLOY_CONTAINER_NAME || true"
- ssh -p $DEPLOY_SERVER_SSH_PORT $DEPLOY_SERVER_USERNAME@$DEPLOY_SERVER "docker pull $CRE_REGISTRY_IMAGE:latest"
- ssh -p $DEPLOY_SERVER_SSH_PORT $DEPLOY_SERVER_USERNAME@$DEPLOY_SERVER "docker run -d -p $CRE_PORT:9090 --name=$DEPLOY_CONTAINER_NAME -v $DEPLOY_DATA_VOLUME:/usr/bin/cre/data -v $DEPLOY_CONFIG_VOLUME:/usr/bin/cre/config -e spring_profiles_active=$DEPLOY_SPRING_PROFILES $CRE_REGISTRY_IMAGE"
- ssh -p $DEPLOY_SERVER_SSH_PORT $DEPLOY_SERVER_USERNAME@$DEPLOY_SERVER "docker run -d -p $CRE_PORT:9090 --name=$DEPLOY_CONTAINER_NAME -v $DEPLOY_DATA_VOLUME:/usr/bin/data -v $DEPLOY_CONFIG_VOLUME:/usr/bin/config -e spring_profiles_active=$DEPLOY_SPRING_PROFILES $CRE_REGISTRY_IMAGE"
when:
branch: master
events: push

View File

@ -1,11 +1,21 @@
ARG GRADLE_VERSION=7.1
ARG JAVA_VERSION=11
ARG CRE_VERSION=dev
FROM openjdk:$JAVA_VERSION
FROM gradle:$GRADLE_VERSION-jdk$JAVA_VERSION AS build
WORKDIR /usr/src
WORKDIR /usr/bin/cre/
COPY . .
RUN gradle bootJar -Pversion=$CRE_VERSION
ARG CRE_ARTIFACT_NAME=ColorRecipesExplorer
COPY $CRE_ARTIFACT_NAME.jar ColorRecipesExplorer.jar
FROM alpine:latest
WORKDIR /usr/bin
ARG JAVA_VERSION
RUN apk add --no-cache openjdk$JAVA_VERSION
ARG CRE_VERSION
COPY --from=build /usr/src/build/libs/ColorRecipesExplorer.jar ColorRecipesExplorer.jar
ARG CRE_PORT=9090
EXPOSE $CRE_PORT
@ -16,7 +26,7 @@ ENV spring_datasource_url=jdbc:h2:mem:cre
ENV spring_datasource_username=root
ENV spring_datasource_password=pass
VOLUME /usr/bin/cre/data
VOLUME /usr/bin/cre/config
VOLUME /usr/bin/data
VOLUME /usr/bin/config
ENTRYPOINT ["java", "-jar", "ColorRecipesExplorer.jar"]

View File

@ -1,10 +0,0 @@
ARG JDK_VERSION=11
ARG GRADLE_VERSION=7.1
FROM gradle:$GRADLE_VERSION-jdk$JDK_VERSION
WORKDIR /usr/src/cre/
COPY build.gradle.kts build.gradle.kts
COPY settings.gradle.kts settings.gradle.kts
COPY src src

View File

@ -1,15 +0,0 @@
== Icônes pour recettes non-approuvés / quantité faible ==
== Texte SIMDUT inexistant (fiche signalitique) pour les matériaux ==
== Comptes ==
No employé - Permissions - Employés
== Kits de retouche ==
No Job - No Dossier - Qté - Description - Case à cocher - Note
Bouton compléter si tout est coché/imprimé ?
Enregistrer localdatetime/personne pendant une certaine durée