Skip to content

Commit

Permalink
Add Docker configuration.
Browse files Browse the repository at this point in the history
Add docker-compose and Dockerfile, which spins up a postgres and
vss instance. We override env variables such as vss.jdbc.url,
to point to postgres container.
  • Loading branch information
G8XSU committed Sep 6, 2024
1 parent 937418c commit 28df699
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Use official Tomcat base image
FROM tomcat:jre17

# Copy WAR file
COPY app/build/libs/vss-1.0.war /usr/local/tomcat/webapps/vss.war

ENV vss.jdbc.url="jdbc:postgresql://postgres:5432/postgres"
ENV vss.jdbc.username=postgres
ENV vss.jdbc.password=YOU_MUST_CHANGE_THIS_PASSWORD

EXPOSE 8080
CMD ["catalina.sh", "run"]
33 changes: 33 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
version: '3.8'
services:
postgres:
image: postgres:15
environment:
POSTGRES_DB: postgres
POSTGRES_USER: postgres
POSTGRES_PASSWORD: YOU_MUST_CHANGE_THIS_PASSWORD
volumes:
- postgres-data:/var/lib/postgresql/data
- ./app/src/main/java/org/vss/impl/postgres/sql/v0_create_vss_db.sql:/docker-entrypoint-initdb.d/init.sql
ports:
- "5432:5432"
networks:
- app-network

tomcat:
build:
context: .
container_name: tomcat
depends_on:
- postgres
ports:
- "8080:8080"
networks:
- app-network

volumes:
postgres-data:

networks:
app-network:
driver: bridge

0 comments on commit 28df699

Please sign in to comment.