Добавил Dockerfile и docker-compose.yml
This commit is contained in:
parent
21eec17576
commit
b8edeac404
37
Dockerfile
Normal file
37
Dockerfile
Normal file
@ -0,0 +1,37 @@
|
||||
FROM eclipse-temurin:17 as app-build
|
||||
ENV RELEASE=17
|
||||
|
||||
WORKDIR /opt/build
|
||||
COPY ./gitlab-app/target/gitlab-notification.jar ./application.jar
|
||||
|
||||
RUN java -Djarmode=layertools -jar application.jar extract
|
||||
RUN $JAVA_HOME/bin/jlink \
|
||||
--add-modules `jdeps --ignore-missing-deps -q -recursive --multi-release ${RELEASE} --print-module-deps -cp 'dependencies/BOOT-INF/lib/*' application.jar`,jdk.crypto.cryptoki \
|
||||
--strip-debug \
|
||||
--no-man-pages \
|
||||
--no-header-files \
|
||||
--compress=2 \
|
||||
--output jdk
|
||||
|
||||
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 \
|
||||
&& useradd --uid 1000 --gid spring-app --shell /bin/bash --create-home spring-app
|
||||
|
||||
USER spring-app:spring-app
|
||||
WORKDIR /opt/workspace
|
||||
|
||||
COPY --from=app-build $BUILD_PATH/jdk $JAVA_HOME
|
||||
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 -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
|
@ -1,12 +1,12 @@
|
||||
FROM openjdk:17.0.2-jdk-slim-buster
|
||||
MAINTAINER uPagge <me@upagge.ru>
|
||||
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 target/gitlab-notification.jar app.jar
|
||||
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 \
|
29
docker-compose-dev.yml
Normal file
29
docker-compose-dev.yml
Normal file
@ -0,0 +1,29 @@
|
||||
version: '3.3'
|
||||
|
||||
services:
|
||||
|
||||
database:
|
||||
image: postgres:15.1-alpine
|
||||
environment:
|
||||
POSTGRES_DB: "gitlab_bot"
|
||||
POSTGRES_USER: "postgres"
|
||||
POSTGRES_PASSWORD: ${DATASOURCE_PASSWORD}
|
||||
volumes:
|
||||
- database:/var/lib/postgresql/data/
|
||||
|
||||
gitlab-bot:
|
||||
build: .
|
||||
depends_on:
|
||||
- database
|
||||
environment:
|
||||
TELEGRAM_BOT_TOKEN: ${TELEGRAM_BOT_TOKEN}
|
||||
TELEGRAM_BOT_USERNAME: ${TELEGRAM_BOT_USERNAME}
|
||||
GITLAB_PERSONAL_TOKEN: ${GITLAB_PERSONAL_TOKEN}
|
||||
TELEGRAM_PERSON_ID: ${TELEGRAM_PERSON_ID}
|
||||
GITLAB_URL: ${GITLAB_URL}
|
||||
DATASOURCE_URL: "jdbc:postgresql://database:5432/gitlab_bot"
|
||||
DATASOURCE_USERNAME: "postgres"
|
||||
DATASOURCE_PASSWORD: ${DATASOURCE_PASSWORD}
|
||||
|
||||
volumes:
|
||||
database:
|
31
docker-compose.yml
Normal file
31
docker-compose.yml
Normal file
@ -0,0 +1,31 @@
|
||||
version: '3.3'
|
||||
|
||||
services:
|
||||
|
||||
database:
|
||||
image: postgres:15.1-alpine
|
||||
restart: always
|
||||
environment:
|
||||
POSTGRES_DB: "gitlab_bot"
|
||||
POSTGRES_USER: "postgres"
|
||||
POSTGRES_PASSWORD: ${DATASOURCE_PASSWORD}
|
||||
volumes:
|
||||
- database:/var/lib/postgresql/data/
|
||||
|
||||
gitlab-bot:
|
||||
image: upagge/gitlab-telegram-notify:latest
|
||||
restart: always
|
||||
depends_on:
|
||||
- database
|
||||
environment:
|
||||
TELEGRAM_BOT_TOKEN: ${TELEGRAM_BOT_TOKEN}
|
||||
TELEGRAM_BOT_USERNAME: ${TELEGRAM_BOT_USERNAME}
|
||||
GITLAB_PERSONAL_TOKEN: ${GITLAB_PERSONAL_TOKEN}
|
||||
TELEGRAM_PERSON_ID: ${TELEGRAM_PERSON_ID}
|
||||
GITLAB_URL: ${GITLAB_URL}
|
||||
DATASOURCE_URL: "jdbc:postgresql://database:5432/gitlab_bot"
|
||||
DATASOURCE_USERNAME: "postgres"
|
||||
DATASOURCE_PASSWORD: ${DATASOURCE_PASSWORD}
|
||||
|
||||
volumes:
|
||||
database:
|
2
pom.xml
2
pom.xml
@ -44,7 +44,7 @@
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
|
||||
<godfather.telegram.core.version>0.0.37</godfather.telegram.core.version>
|
||||
<godfather.telegram.core.version>0.0.38</godfather.telegram.core.version>
|
||||
|
||||
<javax.persistance.version>2.2</javax.persistance.version>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user