Skip to content

Commit

Permalink
Merge pull request #87 from idabblewith/main
Browse files Browse the repository at this point in the history
Update Dockerfile (comment out user stuff until migration)
  • Loading branch information
idabblewith authored Jun 24, 2024
2 parents 203ee04 + 4a6c1cf commit f26e401
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,12 @@ RUN poetry install

# ====================== USER & PERMISSIONS ======================
# # Create Non-root: assign build time vars UID and GID to same value 10001
ARG UID=10001
ARG GID=10001
# Create Non-root: use vars to create group and user assigned to it,
# without home or log files
RUN groupadd -g "${GID}" spmsuser \
&& useradd --create-home --home-dir /home/spmsuser --no-log-init --uid "${UID}" --gid "${GID}" spmsuser
# ARG UID=10001
# ARG GID=10001
# # Create Non-root: use vars to create group and user assigned to it,
# # without home or log files
# RUN groupadd -g "${GID}" spmsuser \
# && useradd --create-home --home-dir /home/spmsuser --no-log-init --uid "${UID}" --gid "${GID}" spmsuser

# Add the alias commands and configure the bash file
RUN echo '# Custom .bashrc modifications\n' \
Expand Down Expand Up @@ -93,23 +93,24 @@ RUN echo '# Custom .bashrc modifications\n' \
'alias connect_test="PGPASSWORD=$UAT_PASSWORD psql -h $PRODUCTION_HOST -d $UAT_DB_NAME -U $UAT_USERNAME"\n' \
'alias dump_test="PGPASSWORD=$UAT_PASSWORD pg_dump -h $PRODUCTION_HOST -d $UAT_DB_NAME -U $UAT_USERNAME -f uat_dump.sql"\n' \
'alias res_test="PGPASSWORD=$UAT_PASSWORD psql -h $PRODUCTION_HOST -d $UAT_DB_NAME -U $UAT_USERNAME -a -f uat_dump.sql"\n' \
'settz\n'>> /home/spmsuser/.bashrc
'settz\n'>> ~/.bashrc
# >> /home/spmsuser/.bashrc
# >> ~/.bashrc
# >> /home/spmsuser/.bashrc

# Ensure bashrc belongs to correct user and runs
RUN chown ${UID}:${GID} /home/spmsuser/.bashrc
# Own app
RUN chown -R ${UID}:${GID} /usr/src/app
# Own the license file to update it
RUN chown -R ${UID}:${GID} /usr/lib/prince/license
# Ensure entrypoint script can run for prince license and gunicorn
# # Ensure bashrc belongs to correct user and runs
# RUN chown ${UID}:${GID} /home/spmsuser/.bashrc
# # Own app
# RUN chown -R ${UID}:${GID} /usr/src/app
# # Own the license file to update it
# RUN chown -R ${UID}:${GID} /usr/lib/prince/license
# # Ensure entrypoint script can run for prince license and gunicorn
RUN chmod +x /usr/src/app/backend/entrypoint.sh
# Ownership of files etc. is set in init container
# chown -R ${UID}:${GID} /usr/src/app/backend/files

# # Switch to non-root user
USER ${UID}
# USER ${UID}

# ====================== LAUNCH ======================
# Expose and enter entry point (launch django app on p 8000)
Expand Down

0 comments on commit f26e401

Please sign in to comment.