Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DATAGO-59496: Make docker run for user without root access #108

Merged
merged 5 commits into from
Aug 2, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
export GITHASH=$(git rev-parse HEAD)
export GITBRANCH=$(git branch --show-current)
export BUILD_TIMESTAMP=$(date -u)
Expand Down
Loading