Add Dockerfile and sample docker-compose.yml

This commit is contained in:
William Brawner 2023-01-25 22:00:58 -07:00
parent d82dcc979d
commit 3d47225e70
Signed by: wbrawner
GPG key ID: 8FF12381C6C90D35
2 changed files with 46 additions and 0 deletions

19
Dockerfile Normal file
View file

@ -0,0 +1,19 @@
FROM openjdk:17-jdk as builder
MAINTAINER William Brawner <me@wbrawner.com>
RUN microdnf install findutils
RUN groupadd --system --gid 1000 gradle \
&& useradd --system --gid gradle --uid 1000 --shell /bin/bash --create-home gradle
COPY --chown=gradle:gradle . /home/gradle/src
WORKDIR /home/gradle/src
RUN /home/gradle/src/gradlew --console=plain --no-daemon shadowJar
FROM openjdk:17-slim
EXPOSE 8080
RUN groupadd --system --gid 1000 civicsbot \
&& useradd --system --gid civicsbot --uid 1000 --create-home civicsbot
COPY --from=builder --chown=civicsbot:civicsbot /home/gradle/src/build/libs/civics-quiz-bot.jar civics-quiz-bot.jar
USER civicsbot
CMD /usr/local/openjdk-17/bin/java $JVM_ARGS -jar /civics-quiz-bot.jar

27
docker-compose.yml Normal file
View file

@ -0,0 +1,27 @@
version: "3.3"
services:
bot:
build: .
ports:
- "8080:8080"
environment:
- CIVICS_DB_HOST=db
networks:
- civics
hostname: bot
db:
image: postgres:14
ports:
- "5432:5432"
environment:
POSTGRES_DB: postgres
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
networks:
- civics
hostname: db
networks:
civics: