-
Notifications
You must be signed in to change notification settings - Fork 176
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: abhishek8shankar <[email protected]>
- Loading branch information
1 parent
6ca6bd2
commit 53d8710
Showing
1 changed file
with
17 additions
and
24 deletions.
There are no files selected for viewing
41 changes: 17 additions & 24 deletions
41
registration-processor/init/registration-processor-dmz-packet-server/Dockerfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,32 @@ | ||
FROM nginx | ||
|
||
ARG SOURCE | ||
ARG COMMIT_HASH | ||
ARG COMMIT_ID | ||
ARG BUILD_TIME | ||
LABEL source=${SOURCE} | ||
LABEL commit_hash=${COMMIT_HASH} | ||
LABEL commit_id=${COMMIT_ID} | ||
LABEL build_time=${BUILD_TIME} | ||
|
||
# Define arguments for user and group | ||
# Define arguments | ||
ARG container_user=mosip | ||
ARG container_user_group=mosip | ||
ARG container_user_uid=1001 | ||
ARG container_user_gid=1001 | ||
|
||
# Expose port 8082 | ||
EXPOSE 8082 | ||
# Create a user and group inside the container | ||
RUN addgroup --gid ${container_user_gid} ${container_user_group} && \ | ||
adduser --disabled-password --gecos '' --uid ${container_user_uid} --gid ${container_user_gid} ${container_user} | ||
|
||
# Set working directory | ||
# Set the working directory | ||
WORKDIR /home/${container_user} | ||
|
||
# Copy nginx configuration file | ||
# Copy nginx.conf file | ||
COPY nginx.conf /etc/nginx/nginx.conf | ||
|
||
# Ensure the user and group exist, copy files, set permissions | ||
RUN groupadd -g ${container_user_gid} ${container_user_group} \ | ||
&& useradd -u ${container_user_uid} -g ${container_user_group} -m ${container_user} \ | ||
&& mkdir -p /home/mosip/landing/ \ | ||
&& cp /home/mosip/landing/healthcheck.txt /home/mosip/landing/healthcheck.txt.bak \ | ||
&& chown -R ${container_user}:${container_user} /home/${container_user} \ | ||
&& mv /etc/nginx/nginx.conf /etc/nginx/nginx.conf.bak \ | ||
&& mv /home/mosip/landing/healthcheck.txt /home/mosip/landing/healthcheck.txt.bak | ||
# Copy healthcheck.txt file | ||
COPY healthcheck.txt /home/${container_user}/landing/healthcheck.txt | ||
|
||
# Start Nginx with daemon off | ||
CMD ["nginx", "-g", "daemon off;"] | ||
# Change ownership of /home/mosip directory | ||
RUN chown -R ${container_user}:${container_user} /home/${container_user} | ||
|
||
# Change user and group to the created user and group | ||
USER ${container_user_uid}:${container_user_gid} | ||
|
||
# Expose port 8082 | ||
EXPOSE 8082 | ||
|
||
# Run nginx | ||
CMD ["nginx", "-g", "daemon off;"] |