35 lines
740 B
Docker
35 lines
740 B
Docker
###
|
|
### Stage 1 - Builder Container
|
|
###
|
|
|
|
FROM eclipse-temurin:17-jdk as builder
|
|
|
|
# Install build requirements
|
|
#RUN apk update && apk add --no-cache cargo
|
|
|
|
# Copy our application sourcecode to the container
|
|
WORKDIR /tmp/java/
|
|
COPY . /tmp/java/
|
|
|
|
# Build our application from the sourcecode
|
|
RUN ./gradlew clean build
|
|
|
|
|
|
|
|
###
|
|
### Stage 1 - Runtime Container
|
|
###
|
|
|
|
FROM eclipse-temurin:17-jre-ubi9-minimal as runtime
|
|
|
|
# Install runtime requirements
|
|
#RUN apk update && apk add --no-cache libgcc
|
|
|
|
# Copy our binary artifact from the previous building stage
|
|
COPY --from=builder /tmp/java/build/libs/hello-*-all.jar /opt/app/hello.jar
|
|
|
|
# Instructions for running our application
|
|
USER nobody
|
|
WORKDIR /opt/app
|
|
CMD ["java", "-jar", "/opt/app/hello.jar"]
|