-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
37 lines (27 loc) · 1007 Bytes
/
Dockerfile
File metadata and controls
37 lines (27 loc) · 1007 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# Use official OpenJDK base image
FROM openjdk:17-jdk-slim
# Install curl and unzip
RUN apt-get update && apt-get install -y curl unzip
# Set working directory
WORKDIR /backend
# Copy Gradle executable
COPY gradlew .
COPY gradle gradle
# Copy build configuration
COPY build.gradle .
COPY settings.gradle .
# Make gradlew executable
RUN chmod +x ./gradlew
# Manually download and install Gradle
RUN mkdir -p /root/.gradle/wrapper/dists/gradle-8.12.1-bin/abcdefg && \
curl -L --connect-timeout 60 --retry 5 --retry-delay 5 https://services.gradle.org/distributions/gradle-8.12.1-bin.zip -o /tmp/gradle.zip && \
unzip /tmp/gradle.zip -d /root/.gradle/wrapper/dists/gradle-8.12.1-bin/abcdefg && \
rm /tmp/gradle.zip
# Copy source code (do this first to avoid redownloading dependencies)
COPY src ./src
# Build the application
RUN ./gradlew build -x test --no-daemon
# Expose port
EXPOSE 8080
# Run the jar file
ENTRYPOINT ["java", "-jar", "/backend/build/libs/univCabi-0.0.1-SNAPSHOT.jar"]