Skip to content
Merged
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
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Dockerfile
docker-compose.yml
6 changes: 6 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
DB_ROOT_PASSWORD=your_root_password
DB_PASSWORD=your_password
DB_USERNAME=root
DB_URL=jdbc:mysql://docker-mysql:3306/database?createDatabaseIfNotExist=true&useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=UTC
JWT_SECRET=your_jwt_secret_here
CORS_ORIGINS=http://localhost:5173
23 changes: 23 additions & 0 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Build stage
FROM maven:3.9-eclipse-temurin-17 AS build

WORKDIR /app

COPY .mvn/ .mvn/
COPY mvnw pom.xml ./

RUN chmod +x mvnw
RUN ./mvnw dependency:go-offline

COPY src ./src

RUN ./mvnw clean package -DskipTests

FROM amazoncorretto:17-alpine-jdk
WORKDIR /app

COPY --from=build /app/target/*.jar app.jar

EXPOSE 8080

ENTRYPOINT ["java", "-jar", "app.jar"]
2 changes: 0 additions & 2 deletions backend/src/main/java/app/common/util/DatabaseSeeder.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ public class DatabaseSeeder implements CommandLineRunner {
private static final StringConverter CONVERTER = new StringConverterImpl();
private static final String CSV_PREFIX = "data/csv";

// ==================== Log Message Enum ====================

// @formatter:off
private enum LogMessage {
SEEDING_DISABLED("Database seeding is disabled"),
Expand Down
7 changes: 4 additions & 3 deletions backend/src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ spring.application.name=business-management-platform
server.port=8080

# MySQL Database Configuration
spring.datasource.url=jdbc:mysql://localhost:3306/business_management_db?createDatabaseIfNotExist=true
spring.datasource.url=${SPRING_DATASOURCE_URL:jdbc:mysql://localhost:3306/business_management_db?createDatabaseIfNotExist=true}
spring.datasource.username=${DB_USERNAME:root}
spring.datasource.password=${DB_PASSWORD:}
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver

# JPA/Hibernate Settings - Auto-generate tables from entity classes
spring.jpa.hibernate.ddl-auto=create
spring.jpa.hibernate.ddl-auto=update
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL8Dialect
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQLDialect
spring.jpa.properties.hibernate.format_sql=true

# File Upload Settings (for CSV imports)
Expand All @@ -26,6 +26,7 @@ logging.level.org.springframework.web=INFO
payroll.default.tax.rate=0.20
payroll.default.insurance.rate=0.05
payroll.calculation.precision=2

# JWT Configuration
jwt.secret=${JWT_SECRET:Pgcdtg888o+XX18Wkqf+J2X7/a+VJHbj4zvwfAMFtA0=}
jwt.expiration=86400000
Expand Down
51 changes: 51 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
services:
docker-mysql:
image: mysql:9.5
container_name: docker-mysql
environment:
MYSQL_ALLOW_EMPTY_PASSWORD: "yes"
MYSQL_DATABASE: database
ports:
- "3307:3306"
networks:
- buzy_network
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
volumes:
- mysql_data:/var/lib/mysql

backend:
build: ./backend
container_name: backend
ports:
- "8080:8080"
depends_on:
docker-mysql:
condition: service_healthy
environment:
SPRING_DATASOURCE_URL: ${DB_URL}
SPRING_DATASOURCE_USERNAME: ${DB_USERNAME}
SPRING_DATASOURCE_PASSWORD: ${DB_PASSWORD}
networks:
- buzy_network

frontend:
build: ./frontend
container_name: frontend
ports:
- "5173:80"
depends_on:
- backend
networks:
- buzy_network

networks:
buzy_network:
driver: bridge

volumes:
mysql_data:
11 changes: 11 additions & 0 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM node:20-alpine AS build
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
RUN npm run build

FROM nginx:alpine
COPY --from=build /app/dist /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
Loading