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

[MOSIP-31575] Updated docker file. #75

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
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
14 changes: 13 additions & 1 deletion keycloak-artemis/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,19 @@ RUN chmod +x /usr/sbin/install_packages && chmod g+rwX /opt/bitnami && \
# Install required system packages and dependencies
RUN . /usr/sbin/install_packages acl ca-certificates curl gzip libaio1 libc6 procps rsync tar zlib1g

USER 1001
ARG container_user=mosip
ARG container_user_group=mosip
ARG container_user_uid=1001
ARG container_user_gid=1001

# Create and set ownership for the container user
RUN groupadd -g ${container_user_gid} ${container_user_group} && \
useradd -r -u ${container_user_uid} -g ${container_user_group} ${container_user} && \
mkdir -p /home/${container_user} && \
chown -R ${container_user}:${container_user} /home/${container_user}

USER ${container_user_uid}:${container_user_gid}
WORKDIR /home/${container_user}

ENTRYPOINT [ "/opt/bitnami/scripts/keycloak/entrypoint.sh" ]

Expand Down
20 changes: 6 additions & 14 deletions keycloak-init/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,18 @@ LABEL build_time=${BUILD_TIME}

# can be passed during Docker build as build time environment for github branch to pickup configuration from.
ARG container_user=mosip

# can be passed during Docker build as build time environment for github branch to pickup configuration from.
ARG container_user_group=mosip

# can be passed during Docker build as build time environment for github branch to pickup configuration from.
ARG container_user_uid=1001

# can be passed during Docker build as build time environment for github branch to pickup configuration from.
ARG container_user_gid=1001

# install packages and create user
RUN apt-get -y update \
&& groupadd -g ${container_user_gid} ${container_user_group} \
&& useradd -u ${container_user_uid} -g ${container_user_group} -s /bin/sh -m ${container_user}

COPY requirements.txt .
RUN pip3 install -r requirements.txt

# change permissions of file inside working dir
RUN chown -R ${container_user}:${container_user} /home/${container_user}
## install packages, create user and change permissions of file inside working dir
RUN apt-get -y update \
&& groupadd -g ${container_user_gid} ${container_user_group} \
&& useradd -u ${container_user_uid} -g ${container_user_group} -s /bin/sh -m ${container_user} \
&& pip3 install -r requirements.txt \
&& chown -R ${container_user}:${container_user} /home/${container_user}

# select container user for all tasks
USER ${container_user_uid}:${container_user_gid}
Expand Down
20 changes: 19 additions & 1 deletion keycloak-jboss/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,26 @@ RUN cp -R ./theme/mosip /opt/jboss/keycloak/themes/mosip

RUN cp -R ./theme/base /opt/jboss/keycloak/themes


ADD --chown=jboss:root ./standalone/ ./standalone

RUN cp -R ./standalone/deployments/* /opt/jboss/keycloak/standalone/deployments

ARG container_user=mosip
ARG container_user_group=mosip
ARG container_user_uid=1001
ARG container_user_gid=1001

# Create user and group
RUN groupadd -r ${container_user_group} -g ${container_user_gid} \
&& useradd -u ${container_user_uid} -r -g ${container_user_group} -m -d /home/${container_user} -s /sbin/nologin -c "Docker image user" ${container_user}

# Set ownership of home directory
RUN chown -R ${container_user}:${container_user} /home/${container_user}

# Switch to non-root user
USER ${container_user}:${container_user}

USER ${container_user_uid}:${container_user_gid}

# Change working directory
WORKDIR /home/${container_user}
Loading