Skip to content

Commit

Permalink
DATAGO-81660 updated dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
rudraneel-chakraborty committed Aug 12, 2024
1 parent 7b0b78d commit a5d942d
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion service/application/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
ARG BASE_IMAGE
FROM ${BASE_IMAGE}

# default user name is "emauser"
ARG USER=emauser
ENV HOME /home/$USER

VOLUME /tmp

# install sudo as root
RUN apk add --update sudo

# create user
RUN adduser -D $USER \
&& echo "$USER ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/$USER \
&& chmod 0440 /etc/sudoers.d/$USER

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

Expand All @@ -14,7 +26,11 @@ 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
RUN sudo chown -R $USER:$USER $HOME

RUN sudo chown -R $USER:$USER /opt/ema/

COPY .terraformrc $HOME/.terraformrc

RUN printf '#!/bin/ash\ntofu $*' > /opt/ema/terraform/terraform
RUN chmod +x /opt/ema/terraform/terraform
Expand All @@ -32,4 +48,7 @@ ENV GITHASH="${GITHASH}" \
ARG JAR_FILE
ADD ${JAR_FILE} app.jar

# switch to the created user from root
USER $USER

ENTRYPOINT [ "sh", "-c", "java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar /opt/ema/app.jar $CMD_LINE_ARGS --spring.config.location=file:/config/ema.yml"]

0 comments on commit a5d942d

Please sign in to comment.