-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
40 lines (30 loc) · 1.05 KB
/
Dockerfile
File metadata and controls
40 lines (30 loc) · 1.05 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
FROM maven:3-sapmachine AS build
WORKDIR /workspace
# copy pom first to leverage Docker cache for dependencies
COPY pom.xml .
# Download dependencies (this layer will be cached if pom.xml doesn't change)
RUN --mount=type=cache,target=/root/.m2 mvn dependency:go-offline -B
# copy source and build
COPY src ./src
RUN --mount=type=cache,target=/root/.m2 mvn -DskipTests package
FROM eclipse-temurin:25-jre
WORKDIR /app
ENV JAVA_OPTS=""
# copy the built jar (matches any jar produced by the build)
COPY --from=build /workspace/target/*jar-with-dependencies.jar app.jar
# Create a non-root user for security
RUN groupadd -r osmtools && useradd -r -g osmtools osmtools
RUN chown -R osmtools:osmtools /app
# disable this user because azure pipelines wants to create a new user
#USER osmtools
COPY --chmod=755 <<EOT /entrypoint.sh
#!/usr/bin/env bash
set -exu
java \$JAVA_OPTS -jar /app/app.jar \$@
EOT
COPY --chmod=755 <<EOT /simplify.sh
#!/usr/bin/env bash
set -exu
java \$JAVA_OPTS -cp /app/app.jar net.leberfinger.geo.GeoJSONSimplify \$@
EOT
CMD ["/entrypoint.sh"]