Commit 0a67f43d authored by LAVENIER's avatar LAVENIER
Browse files

[fix] CI: fix yaml

parent 482eb1ee
......@@ -240,8 +240,38 @@ gitlab-release:
- cp -f ${ARTIFACT_WAR_FILE} target/docker/app.war
- cp -f ${ARTIFACT_CONFIG_FILES} target/docker/config/
- ls -l target/docker/config
# Build docker image
- cd target/docker
# Create the starter script
- echo '#!/bin/bash' > app.sh
- echo 'BASEDIR=/app' >> app.sh
- echo 'JAVA_OPTS="-Dsumaris.basedir=${BASEDIR}"' >> app.sh
- echo 'JAVA_OPTS="$JAVA_OPTS -Dspring.config.location=${BASEDIR}/config/"' >> app.sh
- echo 'JAVA_OPTS="$JAVA_OPTS -Doracle.net.tns_admin=/home/tnsnames' >> app.sh
- echo 'JAVA_OPTS="$JAVA_OPTS -Doracle.jdbc.timezoneAsRegion=false"' >> app.sh
- echo '[[ "_${PROFILES}" != "_" ]] && JAVA_OPTS="$JAVA_OPTS -Dspring.profiles.active=${PROFILES}"' >> app.sh
- echo '[[ "_${TZ}" != "_" ]] && JAVA_OPTS="$JAVA_OPTS -Duser.timezone=${TZ}"' >> app.sh
- echo '[[ "_${PORT}" != "_" ]] && JAVA_OPTS="$JAVA_OPTS -Dserver.port=${PORT}"' >> app.sh
- echo 'ARGS=${@:2}' >> app.sh
- echo 'java ${JAVA_OPTS} -server -jar ${BASEDIR}/app.war ${ARGS}' >> app.sh
# Create the Dockerfile
- echo 'FROM openjdk:8-jdk-alpine' > Dockerfile
- echo "ARG WAR_FILE=app.war" >> Dockerfile
- echo "ARG CONFIG_FILES=config/*.properties" >> Dockerfile
- echo 'RUN apt-get update && apt-get -y install libsodium-dev' >> Dockerfile
#- echo 'RUN addgroup -S spring && adduser -S spring -G spring' >> Dockerfile
#- echo 'USER spring:spring' >> Dockerfile
- echo 'WORKDIR /app' >> Dockerfile
- echo 'COPY app.sh app.sh' >> Dockerfile
- echo 'RUN chmod +x app.sh' >> Dockerfile
- echo 'COPY ${WAR_FILE} app.war' >> Dockerfile
- echo 'RUN mkdir config' >> Dockerfile
- echo 'COPY ${CONFIG_FILES} ./config/' >> Dockerfile
- echo 'ENV PORT=8080 \' >> Dockerfile
- echo ' TZ=UTC \' >> Dockerfile
- echo ' PROFILES=default' >> Dockerfile
- echo 'EXPOSE ${PORT}' >> Dockerfile
- echo 'ENTRYPOINT ["app.sh"]' >> Dockerfile
# Build docker image
- docker pull ${CI_REGISTRY_IMAGE}:${IMAGE_TAG} || true
- docker build --cache-from ${CI_REGISTRY_IMAGE}:${IMAGE_TAG} --pull -t ${CI_REGISTRY_IMAGE}:${IMAGE_TAG} .
- docker push ${CI_REGISTRY_IMAGE}:${IMAGE_TAG}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment