Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# ---------- Build Stage ----------
FROM maven:3.9.6-eclipse-temurin-17 AS build
WORKDIR /app
COPY pom.xml .
RUN mvn dependency:go-offline
COPY src ./src
RUN mvn clean package -DskipTests




FROM tomcat:10.1-jdk17-temurin
RUN rm -rf /usr/local/tomcat/webapps/*
COPY --from=build /app/target/*.war /usr/local/tomcat/webapps/ROOT.war
EXPOSE 8082
CMD ["catalina.sh", "run"]
37 changes: 37 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
version: "3.9"

services:
db:
image: mysql:8.0
container_name: vprofile-db
restart: unless-stopped
environment:
MYSQL_DATABASE: accounts
MYSQL_USER: vprofile
MYSQL_PASSWORD: vprofile123
MYSQL_ROOT_PASSWORD: root123
volumes:
- dbdata:/var/lib/mysql
# optional: auto-init schema
# - ./src/main/resources/accountsdb.sql:/docker-entrypoint-initdb.d/init.sql
ports:
- "3306:3306"

app:
build:
context: .
dockerfile: Dockerfile
container_name: vprofile-app
restart: unless-stopped
depends_on:
- db
environment:
DB_HOST: db
DB_NAME: accounts
DB_USER: vprofile
DB_PASS: vprofile123
ports:
- "8082:8080"

volumes:
dbdata: