#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 kind: pipeline
name: default name: default
type: docker 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: steps:
- name: test - name: set-docker-tags
image: gradle:7.1-jdk11 image: *alpine-image
environment:
<<: *environment
commands: commands:
- gradle test - echo -n "latest,dev-$CRE_VERSION" > .tags
- cat .tags
when: when:
branch: develop branch: develop
events: push events: push
- name: build - name: gradle-test
image: gradle:7.1-jdk11 image: *gradle-image
commands: commands:
- gradle bootJar -Pversion=$CRE_VERSION - gradle test
- mv build/libs/ColorRecipesExplorer-$CRE_VERSION.jar $CRE_ARTIFACT_NAME.jar
- echo -n "latest,$CRE_VERSION" > .tags
when: when:
branch: master branch: develop
events: push events: [push, pull_request]
- name: containerize - name: containerize
image: plugins/docker image: plugins/docker
environment:
<<: *environment
settings: settings:
build_args: build_args_from_env:
- JAVA_VERSION=11 - GRADLE_VERSION
repo: registry.fyloz.dev:5443/colorrecipesexplorer/backend - JAVA_VERSION
- CRE_VERSION
- CRE_PORT
repo: *docker-registry-repo
when: when:
branch: master branch: master
events: push events: push
@ -40,6 +53,8 @@ steps:
- name: deploy - name: deploy
image: alpine:latest image: alpine:latest
environment: environment:
<<: *environment
CRE_REGISTRY_IMAGE: *docker-registry-repo
DEPLOY_SERVER: DEPLOY_SERVER:
from_secret: deploy_server from_secret: deploy_server
DEPLOY_SERVER_USERNAME: DEPLOY_SERVER_USERNAME:
@ -64,7 +79,7 @@ steps:
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config' - '[[ -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 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 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: when:
branch: master branch: master
events: push events: push

View File

@ -1,11 +1,21 @@
ARG GRADLE_VERSION=7.1
ARG JAVA_VERSION=11 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 FROM alpine:latest
COPY $CRE_ARTIFACT_NAME.jar ColorRecipesExplorer.jar 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 ARG CRE_PORT=9090
EXPOSE $CRE_PORT EXPOSE $CRE_PORT
@ -16,7 +26,7 @@ ENV spring_datasource_url=jdbc:h2:mem:cre
ENV spring_datasource_username=root ENV spring_datasource_username=root
ENV spring_datasource_password=pass ENV spring_datasource_password=pass
VOLUME /usr/bin/cre/data VOLUME /usr/bin/data
VOLUME /usr/bin/cre/config VOLUME /usr/bin/config
ENTRYPOINT ["java", "-jar", "ColorRecipesExplorer.jar"] 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