Skip to content

Commit ff36621

Browse files
committed
Need to update the dockerfile to use multi-stage build for image hosting on github.
1 parent f63e035 commit ff36621

File tree

2 files changed

+28
-6
lines changed

2 files changed

+28
-6
lines changed

Dockerfile

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,34 @@
1+
# Multi-stage build - Build stage
2+
FROM eclipse-temurin:21-jdk AS builder
3+
4+
WORKDIR /app
5+
6+
# Install Git (needed for version determination)
7+
RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
8+
# Copy Git directory as we need the version and build history
9+
COPY .git .git
10+
11+
# Copy Gradle wrapper and build files first
12+
COPY gradlew gradlew.bat ./
13+
COPY gradle gradle
14+
COPY build.gradle.kts settings.gradle.kts ./
15+
16+
# Make gradlew executable
17+
RUN chmod +x gradlew
18+
19+
# Copy source code
20+
COPY src src
21+
22+
# Build using your Gradle wrapper
23+
RUN ./gradlew build --no-daemon
24+
25+
# Runtime stage
126
FROM amazoncorretto:23-al2023-jdk
227

328
WORKDIR /app
429

5-
# Copy the application JAR
6-
COPY ./build/libs/mcp-task-orchestrator-*.jar /app/orchestrator.jar
30+
# Copy the built JAR from the builder stage
31+
COPY --from=builder /app/build/libs/mcp-task-orchestrator-*.jar /app/orchestrator.jar
732

833
# Volume for the SQLite database and configuration
934
VOLUME /app/data

scripts/docker-clean-and-build.bat

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
11
@echo off
2-
echo Building the application with Gradle...
3-
call gradlew clean jar
4-
52
echo Building Docker image...
6-
docker build -t mcp-task-orchestrator .
3+
docker build -t mcp-task-orchestrator:dev .

0 commit comments

Comments
 (0)