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-81660: event-management-agent Dockerfile must account for correct user and user home directory setup #196

Merged
Merged
Changes from all 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
27 changes: 20 additions & 7 deletions service/application/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,26 +1,36 @@
ARG BASE_IMAGE
FROM ${BASE_IMAGE}

# default user name is "emauser"
ARG USER=emauser
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: you can override the username by --build-arg USER=someuser

ENV HOME /home/$USER

VOLUME /tmp

RUN mkdir -p /opt/ema && chmod 777 /opt/ema && mkdir -p /opt/ema/terraform && chmod 777 /opt/ema/terraform
# create user and directory setup
RUN adduser -D $USER && \
mkdir -p /opt/ema && \
chmod 777 /opt/ema && \
mkdir -p /opt/ema/terraform && \
chmod 777 /opt/ema/terraform && \
chown -R $USER:$USER $HOME && \
chown -R $USER:$USER /opt/ema/

WORKDIR /opt/ema

ARG PLATFORM=linux_amd64

COPY tofu_1.7.0_amd64.apk /opt/ema/terraform
RUN apk --update add --allow-untrusted /opt/ema/terraform/tofu_1.7.0_amd64.apk

ARG SOLACE_PROVIDER_VERSION=0.9.2-rc.2
ADD terraform-provider-solacebroker_${SOLACE_PROVIDER_VERSION}_${PLATFORM}.tar.gz /opt/ema/terraform

COPY .terraformrc /root/.terraformrc

COPY .terraformrc $HOME/.terraformrc
RUN printf '#!/bin/ash\ntofu $*' > /opt/ema/terraform/terraform
RUN chmod +x /opt/ema/terraform/terraform

ENV PATH $PATH:/opt/ema/terraform

ARG SOLACE_PROVIDER_VERSION=0.9.2-rc.2
ADD terraform-provider-solacebroker_${SOLACE_PROVIDER_VERSION}_${PLATFORM}.tar.gz /opt/ema/terraform

ARG GITHASH
ARG GITBRANCH
ARG BUILD_TIMESTAMP
Expand All @@ -29,6 +39,9 @@ ENV GITHASH="${GITHASH}" \
GITBRANCH="${GITBRANCH}" \
BUILD_TIMESTAMP="${BUILD_TIMESTAMP}"

# switch to the created user from root
USER $USER

ARG JAR_FILE
ADD ${JAR_FILE} app.jar

Expand Down
Loading