Skip to content

Commit

Permalink
DATAGO-59496: Make docker run for user without root access (#108)
Browse files Browse the repository at this point in the history
  • Loading branch information
gregmeldrum authored Aug 2, 2023
1 parent 17fbb40 commit d5253e2
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 40 deletions.
5 changes: 4 additions & 1 deletion service/application/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ FROM ${BASE_IMAGE}

VOLUME /tmp

RUN mkdir -p /opt/ema && chmod 777 /opt/ema
WORKDIR /opt/ema

ARG GITHASH
ARG GITBRANCH
ARG BUILD_TIMESTAMP
Expand All @@ -14,4 +17,4 @@ ENV GITHASH="${GITHASH}" \
ARG JAR_FILE
ADD ${JAR_FILE} app.jar

ENTRYPOINT [ "sh", "-c", "java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar /app.jar --spring.config.location=file:/config/ema.yml"]
ENTRYPOINT [ "sh", "-c", "java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar /opt/ema/app.jar --spring.config.location=file:/config/ema.yml"]
9 changes: 0 additions & 9 deletions service/application/docker/base-image/Dockerfile

This file was deleted.

8 changes: 0 additions & 8 deletions service/application/docker/base-image/buildBaseImage.sh

This file was deleted.

23 changes: 1 addition & 22 deletions service/application/docker/buildEventManagementAgentDocker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ Available options:
-h, --help Print this help and exit
-v, --verbose Print script debug info
-t, --tag The docker container tag
-bt, --basetag The docker container tag of the base image
EOF
exit
}
Expand Down Expand Up @@ -62,10 +61,6 @@ parse_params() {
IMAGE_TAG="${2-}"
shift
;;
-bt | --basetag) # example named parameter
BASE_IMAGE_TAG="${2-}"
shift
;;
-?*) die "Unknown option: $1" ;;
*) break ;;
esac
Expand All @@ -76,32 +71,16 @@ parse_params() {

# check required params and arguments
[[ -z "${IMAGE_TAG-}" ]] && die "Missing required parameter: tag"
#[[ ${#args[@]} -eq 0 ]] && die "Missing script arguments"

return 0
}

parse_params "$@"
setup_colors

# If the base docker container tag isn't set, use the same tag that was
# provided for the event-management-agent.

[[ -z "${BASE_IMAGE_TAG-}" ]] && BASE_IMAGE_TAG=${IMAGE_TAG}

if [[ "$(docker images -q event-management-agent-base:${BASE_IMAGE_TAG} 2> /dev/null)" == "" ]]; then
# do something
msg "${RED}The base image does not exist, building\n${NOFORMAT}"
cd base-image
./buildBaseImage.sh ${BASE_IMAGE_TAG}
cd ${script_dir}
else
msg "${GREEN}Base image found, using:${YELLOW} event-management-agent-base:${BASE_IMAGE_TAG}\n${NOFORMAT}"
fi

msg "${GREEN}Building image:${YELLOW} event-management-agent:${IMAGE_TAG}\n${NOFORMAT}"

export BASE_IMAGE=event-management-agent-base:${BASE_IMAGE_TAG}
export BASE_IMAGE=eclipse-temurin:11.0.19_7-jdk-alpine
export GITHASH=$(git rev-parse HEAD)
export GITBRANCH=$(git branch --show-current)
export BUILD_TIMESTAMP=$(date -u)
Expand Down

0 comments on commit d5253e2

Please sign in to comment.