Упростил dockerfile

This commit is contained in:
Struchkov Mark 2022-12-13 16:28:17 +03:00
parent 5bf4fb952d
commit ba0388e9fd
2 changed files with 2 additions and 29 deletions

View File

@ -18,12 +18,8 @@ FROM debian:buster-slim
ARG BUILD_PATH=/opt/build
ENV JAVA_HOME=/opt/jdk
ENV PATH "${JAVA_HOME}/bin:${PATH}"
ENV TELEGRAM_PERSON_ID=TELEGRAM_PERSON_ID DATASOURCE_URL=DATASOURCE_URL \
DATASOURCE_PASSWORD=DATASOURCE_PASSWORD DATASOURCE_USERNAME=DATASOURCE_USERNAME \
GITLAB_PERSONAL_TOKEN=GITLAB_PERSONAL_TOKEN TELEGRAM_BOT_TOKEN=TELEGRAM_BOT_TOKEN \
TELEGRAM_BOT_USERNAME=TELEGRAM_BOT_USERNAME GITLAB_URL=GITLAB_URL GITLAB_REPLACE_URL=GITLAB_REPLACE_URL
RUN groupadd --gid 1000 spring-app \
RUN apt update && groupadd --gid 1000 spring-app \
&& useradd --uid 1000 --gid spring-app --shell /bin/bash --create-home spring-app
USER spring-app:spring-app
@ -34,4 +30,4 @@ COPY --from=app-build $BUILD_PATH/spring-boot-loader/ ./
COPY --from=app-build $BUILD_PATH/dependencies/ ./
COPY --from=app-build $BUILD_PATH/application/ ./
ENTRYPOINT java -Dfile.encoding=UTF8 -Dconsole.encoding=UTF8 -DTELEGRAM_BOT_USERNAME=$TELEGRAM_BOT_USERNAME -DTELEGRAM_BOT_TOKEN=$TELEGRAM_BOT_TOKEN -DTELEGRAM_PERSON_ID=$TELEGRAM_PERSON_ID -DDATASOURCE_URL=$DATASOURCE_URL -DDATASOURCE_PASSWORD=$DATASOURCE_PASSWORD -DDATASOURCE_USERNAME=$DATASOURCE_USERNAME -DGITLAB_PERSONAL_TOKEN=$GITLAB_PERSONAL_TOKEN -DGITLAB_URL=$GITLAB_URL -DGITLAB_REPLACE_URL=$GITLAB_REPLACE_URL org.springframework.boot.loader.JarLauncher
ENTRYPOINT ["java", "-Dfile.encoding=UTF8", "-Dconsole.encoding=UTF8", "org.springframework.boot.loader.JarLauncher"]

View File

@ -1,23 +0,0 @@
FROM amazoncorretto:17.0.5
MAINTAINER uPagge <mark@struchkov.dev>
RUN apt upgrade && addgroup gitlabbot --disabled-password && \
adduser gitlabbot --ingroup gitlabbot && \
mkdir -p /bot && \
chown -R gitlabbot:gitlabbot /bot
WORKDIR /bot
USER gitlabbot:gitlabbot
COPY gitlab-app/target/gitlab-notification.jar app.jar
ENV TELEGRAM_PERSON_ID=TELEGRAM_PERSON_ID DATASOURCE_URL=DATASOURCE_URL \
DATASOURCE_PASSWORD=DATASOURCE_PASSWORD DATASOURCE_USERNAME=DATASOURCE_USERNAME \
GITLAB_PERSONAL_TOKEN=GITLAB_PERSONAL_TOKEN TELEGRAM_BOT_TOKEN=TELEGRAM_BOT_TOKEN \
TELEGRAM_BOT_USERNAME=TELEGRAM_BOT_USERNAME GITLAB_URL=GITLAB_URL GITLAB_REPLACE_URL=GITLAB_REPLACE_URL
ENTRYPOINT java -DTELEGRAM_BOT_USERNAME=${TELEGRAM_BOT_USERNAME} \
-DTELEGRAM_BOT_TOKEN=$TELEGRAM_BOT_TOKEN \
-DTELEGRAM_PERSON_ID=$TELEGRAM_PERSON_ID \
-DDATASOURCE_URL=$DATASOURCE_URL \
-DDATASOURCE_PASSWORD=$DATASOURCE_PASSWORD \
-DDATASOURCE_USERNAME=$DATASOURCE_USERNAME \
-DGITLAB_PERSONAL_TOKEN=$GITLAB_PERSONAL_TOKEN \
-DGITLAB_URL=$GITLAB_URL \
-DGITLAB_REPLACE_URL=$GITLAB_REPLACE_URL \
-jar app.jar