Skip to content

Commit

Permalink
fix: alpine image not including bash (#453)
Browse files Browse the repository at this point in the history
* fix: alpine image not including bash

* fix: use of nonroot user
  • Loading branch information
efiege authored Jul 24, 2023
1 parent 422f7e7 commit 455319d
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions connector/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@ RUN --mount=type=cache,target=/home/gradle/.gradle/caches gradle build --no-daem

FROM eclipse-temurin:17-jre-alpine

# Install curl for healthcheck, bash for entrypoint
RUN apk add --no-cache curl bash
SHELL ["/bin/bash", "-c"]

# Create empty properties file to avoid errors when loading properties
RUN touch /emtpy-properties-file.properties

RUN adduser -D -H -s /sbin/nologin edc
USER edc:edc

ARG EDC_LAST_COMMIT_INFO_ARG="The docker container was built outside of github actions and you didn't provide the build arg EDC_LAST_COMMIT_INFO_ARG, so there's no last commit info."
ENV EDC_LAST_COMMIT_INFO=$EDC_LAST_COMMIT_INFO_ARG

Expand All @@ -17,12 +27,6 @@ ENV EDC_BUILD_DATE=$EDC_BUILD_DATE_ARG
# Optional JVM arguments, such as memory settings
ARG JVM_ARGS=""

# Install curl for healthcheck
RUN apk add --no-cache curl

# Create empty properties file to avoid errors when loading properties
RUN touch /emtpy-properties-file.properties

WORKDIR /app

COPY --from=build /home/gradle/project/connector/build/libs/app.jar /app
Expand All @@ -40,4 +44,4 @@ COPY ./connector/.env /app/.env

# Replaces ENV Var statements so they don't overwrite existing ENV Vars
RUN sed -ri 's/^\s*(\S+)=(.*)$/\1=${\1:-"\2"}/' .env
ENTRYPOINT bash -c 'set -a && source /app/.env && set +a && exec java -Djava.util.logging.config.file=/app/logging.properties $JVM_ARGS -jar app.jar'
ENTRYPOINT set -a && source /app/.env && set +a && exec java -Djava.util.logging.config.file=/app/logging.properties $JVM_ARGS -jar app.jar

0 comments on commit 455319d

Please sign in to comment.