mirror of
https://github.com/tiennm99/caro.git
synced 2026-07-21 04:18:49 +00:00
feat: add Docker Compose setup for server and web client
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
**/target
|
||||
**/node_modules
|
||||
**/dist
|
||||
.git
|
||||
.github
|
||||
.claude
|
||||
.idea
|
||||
.vscode
|
||||
docs
|
||||
plans
|
||||
*.md
|
||||
demo.gif
|
||||
repomix-output.xml
|
||||
@@ -0,0 +1,21 @@
|
||||
services:
|
||||
server:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: landlords-server/Dockerfile
|
||||
container_name: caro-server
|
||||
ports:
|
||||
- "1024:1024" # TCP / Protobuf (CLI client)
|
||||
- "1025:1025" # WebSocket + static HTTP (web client)
|
||||
restart: unless-stopped
|
||||
|
||||
web-client:
|
||||
build:
|
||||
context: ./web-client
|
||||
dockerfile: Dockerfile
|
||||
container_name: caro-web-client
|
||||
ports:
|
||||
- "8080:80"
|
||||
depends_on:
|
||||
- server
|
||||
restart: unless-stopped
|
||||
@@ -0,0 +1,28 @@
|
||||
# Build stage: compile server jar with Maven
|
||||
FROM maven:3.9-eclipse-temurin-21 AS build
|
||||
WORKDIR /build
|
||||
|
||||
# Copy parent pom and all module poms first for dependency caching
|
||||
COPY pom.xml .
|
||||
COPY landlords-common/pom.xml landlords-common/
|
||||
COPY landlords-server/pom.xml landlords-server/
|
||||
COPY landlords-client/pom.xml landlords-client/
|
||||
|
||||
# Copy sources (common + server only — client not needed for runtime)
|
||||
COPY landlords-common/src landlords-common/src
|
||||
COPY landlords-server/src landlords-server/src
|
||||
COPY landlords-client/src landlords-client/src
|
||||
COPY protoc-resource protoc-resource
|
||||
|
||||
RUN mvn -B -pl landlords-server -am clean package -DskipTests
|
||||
|
||||
# Runtime stage
|
||||
FROM eclipse-temurin:21-jre-alpine
|
||||
WORKDIR /app
|
||||
|
||||
COPY --from=build /build/landlords-server/target/landlords-server-1.4.0.jar app.jar
|
||||
|
||||
# TCP (protobuf) and WebSocket (WS + static HTTP) ports
|
||||
EXPOSE 1024 1025
|
||||
|
||||
ENTRYPOINT ["java", "-jar", "app.jar", "-p", "1024"]
|
||||
@@ -0,0 +1,17 @@
|
||||
# Build stage: Vite production build
|
||||
FROM node:22-alpine AS build
|
||||
WORKDIR /build
|
||||
|
||||
COPY package.json package-lock.json ./
|
||||
RUN npm ci
|
||||
|
||||
COPY index.html vite.config.js ./
|
||||
COPY public public
|
||||
COPY src src
|
||||
RUN npm run build
|
||||
|
||||
# Runtime stage: nginx serves static assets
|
||||
FROM nginx:alpine
|
||||
COPY --from=build /build/dist /usr/share/nginx/html
|
||||
|
||||
EXPOSE 80
|
||||
Reference in New Issue
Block a user