Skip to content

Commit

Permalink
Improve docker image build (#264)
Browse files Browse the repository at this point in the history
* Delete useless files
* Update gitignore
* Update dockerfile and gradle.properties
  • Loading branch information
raikbitters committed Jul 13, 2023
1 parent 3c7b363 commit 9e7289b
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 234 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ hs_err_pid*
.idea/
build/
.gradle/
.vscode/
26 changes: 0 additions & 26 deletions .travis.yml

This file was deleted.

30 changes: 23 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,25 @@
FROM amazoncorretto:11.0.17
LABEL version=5.7.4 description="Unified Authorization Trap for all ReportPortal's Services" maintainer="Andrei Varabyeu <andrei_varabyeu@epam.com>, Hleb Kanonik <hleb_kanonik@epam.com>"
ARG GH_TOKEN
RUN echo 'exec java ${JAVA_OPTS} -jar service-authorization-5.7.4-exec.jar' > /start.sh && chmod +x /start.sh && \
wget --header="Authorization: Bearer ${GH_TOKEN}" -q https://maven.pkg.github.com/reportportal/service-authorization/com/epam/reportportal/service-authorization/5.7.4/service-authorization-5.7.4-exec.jar
ENV JAVA_OPTS="-Xmx512m -XX:+UseG1GC -XX:InitiatingHeapOccupancyPercent=70 -Djava.security.egd=file:/dev/./urandom"
FROM gradle:6.8.3-jdk11 AS build
ARG BOM_VERSION MIGRATION_VERSION GITHUB_USER GITHUB_TOKEN RELEASE_MODE SCRIPTS_VERSION APP_VERSION
WORKDIR /usr/app
COPY . /usr/app
RUN if [ ${RELEASE_MODE} = true ]; then \
gradle build --exclude-task test \
-PreleaseMode=true \
-PgithubUserName=${GITHUB_USER} \
-PgithubToken=${GITHUB_TOKEN} \
-Pscripts.version=${SCRIPTS_VERSION} \
-Pmigrations.version=${MIGRATION_VERSION} \
-Pbom.version=${BOM_VERSION} \
-Dorg.gradle.project.version=${APP_VERSION}; \
else gradle build --exclude-task test -Dorg.gradle.project.version=${APP_VERSION}; fi

# For ARM build use flag: `--platform linux/arm64`
FROM --platform=$BUILDPLATFORM amazoncorretto:11.0.19
LABEL version=${APP_VERSION} description="EPAM Report portal. Main API Service" maintainer="Andrei Varabyeu <andrei_varabyeu@epam.com>, Hleb Kanonik <hleb_kanonik@epam.com>"
ARG APP_VERSION=${APP_VERSION}
ENV APP_DIR=/usr/app JAVA_OPTS="-Xmx1g -XX:+UseG1GC -XX:InitiatingHeapOccupancyPercent=70 -Djava.security.egd=file:/dev/./urandom"
WORKDIR $APP_DIR
COPY --from=build $APP_DIR/build/libs/service-authorization-*exec.jar .
VOLUME ["/tmp"]
EXPOSE 8080
ENTRYPOINT ./start.sh
ENTRYPOINT exec java ${JAVA_OPTS} -jar ${APP_DIR}/service-authorization-*exec.jar
111 changes: 0 additions & 111 deletions Jenkinsfile.k8s.groovy

This file was deleted.

30 changes: 0 additions & 30 deletions docker/Dockerfile-dev-release

This file was deleted.

32 changes: 0 additions & 32 deletions docker/Dockerfile-develop

This file was deleted.

26 changes: 0 additions & 26 deletions docker/Dockerfile-release

This file was deleted.

4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
version=5.8.1
version=develop
description=Unified Authorization Trap for all ReportPortal's Services
dockerPrepareEnvironment=
dockerJavaOpts=-Xmx512m -XX:+UseG1GC -XX:InitiatingHeapOccupancyPercent=70 -Djava.security.egd=file:/dev/./urandom
dockerJavaOptsDev=-Xmx1g -XX:+UseG1GC -XX:InitiatingHeapOccupancyPercent=70 -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/tmp -Djava.security.egd=file:/dev/./urandom
dockerServerUrl=unix:///var/run/docker.sock
dockerServerUrl=unix:///var/run/docker.sock

0 comments on commit 9e7289b

Please sign in to comment.