Skip to content

Commit fe1fc92

Browse files
committed
Add Docker configuration.
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.
1 parent 12ecd1f commit fe1fc92

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

Dockerfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Use official Tomcat base image
2+
FROM tomcat:jre17
3+
4+
# Copy WAR file
5+
COPY app/build/libs/vss-1.0.war /usr/local/tomcat/webapps/vss.war
6+
7+
ENV vss.jdbc.url="jdbc:postgresql://postgres:5432/postgres"
8+
ENV vss.jdbc.username=postgres
9+
ENV vss.jdbc.password=YOU_MUST_CHANGE_THIS_PASSWORD
10+
11+
EXPOSE 8080
12+
CMD ["catalina.sh", "run"]

docker-compose.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
version: '3.8'
2+
services:
3+
postgres:
4+
image: postgres:15
5+
environment:
6+
POSTGRES_DB: postgres
7+
POSTGRES_USER: postgres
8+
POSTGRES_PASSWORD: YOU_MUST_CHANGE_THIS_PASSWORD
9+
volumes:
10+
- postgres-data:/var/lib/postgresql/data
11+
- ./app/src/main/java/org/vss/impl/postgres/sql/v0_create_vss_db.sql:/docker-entrypoint-initdb.d/init.sql
12+
ports:
13+
- "5432:5432"
14+
networks:
15+
- app-network
16+
17+
tomcat:
18+
build:
19+
context: .
20+
container_name: tomcat
21+
depends_on:
22+
- postgres
23+
ports:
24+
- "8080:8080"
25+
networks:
26+
- app-network
27+
28+
volumes:
29+
postgres-data:
30+
31+
networks:
32+
app-network:
33+
driver: bridge

0 commit comments

Comments
 (0)