Repository navigation
Expand file tree
/
Copy pathDockerfile
More file actions
50 lines (35 loc) · 1.54 KB
/
Copy pathDockerfile
File metadata and controls
50 lines (35 loc) · 1.54 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
# Base image (openjdk:* is deprecated and its tags were removed from Docker Hub).
# Defaults to the JRE image (running a prebuilt fat jar needs no JDK):
ARG BASE_IMAGE=docker.io/eclipse-temurin:17-jre-jammy
FROM ${BASE_IMAGE}
# Argument for JAR file name to use in working directory:
ARG JAR_FILE
# Set working directory
WORKDIR /app
RUN mkdir -p /app
# Copy the specified JAR file into the container
COPY ${JAR_FILE} /app/application.jar
COPY docker/entrypoint.sh /app/entrypoint.sh
# Set permissions for the entrypoint script
RUN chmod +x /app/entrypoint.sh
# Expose application port
EXPOSE 8080
# Use a non-root user
RUN addgroup --system projectforge && adduser --system --ingroup projectforge projectforge
# Install findutils (xargs needed by gradle)
#RUN apt-get update && apt-get install -y findutils && rm -rf /var/lib/apt/lists/*
# pgrep needed by the entrypoint.sh
RUN apt-get update && apt-get install -y procps && rm -rf /var/lib/apt/lists/*
# Expose the port and declare the volume
RUN mkdir -p /ProjectForge && chown -R projectforge:projectforge /ProjectForge
VOLUME /ProjectForge
# ProjectForge's home dir inside the container. Without this, ProjectForgeHomeFinder falls back to
# searching $HOME and the jar location, which doesn't work inside the container:
ENV PROJECTFORGE_HOME=/ProjectForge
COPY docker/environment.sh /ProjectForge
# Switch to the non-root user
USER projectforge:projectforge
# Run the Spring Boot application
ENTRYPOINT ["/app/entrypoint.sh"]
# ENTRYPOINT ["java", "-jar", "/app/application.jar"]
LABEL maintainer="Micromata"