Skip to content

Commit

Permalink
Merge pull request #1090 from INCATools/remove-default-user
Browse files Browse the repository at this point in the history
Remove default user
  • Loading branch information
gouttegd committed Aug 12, 2024
2 parents fe711c1 + 2200206 commit 7da6b03
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions docker/odklite/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -74,27 +74,26 @@ RUN wget -nv https://github.com/lihaoyi/Ammonite/releases/download/$AMMONITE_VER
java -cp /tools/amm ammonite.AmmoniteMain /dev/null

# Install RDF/XML validation script
COPY scripts/check-rdfxml.sh /tools/check-rdfxml

# Force Git to accept working on a repository owned by someone else
RUN echo "[safe]\n directory = /work" >> /etc/gitconfig
COPY --chmod=755 scripts/check-rdfxml.sh /tools/check-rdfxml

# Make sure we run under an existing user account with UID/GID
# matching the UID/GID of the calling user
COPY scripts/entrypoint.sh /usr/local/sbin/odkuser-entrypoint.sh
RUN chmod 755 /usr/local/sbin/odkuser-entrypoint.sh
COPY --chmod=755 scripts/entrypoint.sh /usr/local/sbin/odkuser-entrypoint.sh
ENTRYPOINT ["/usr/local/sbin/odkuser-entrypoint.sh"]
# secure_path is enabled by default in Debian/Ubuntu, disable it
RUN sed -i '/secure_path/d' /etc/sudoers

# Misc tweaks:
# - disable secure_path (we want to be able to use sudo with our custom PATH)
# - remove default user account (we create our own)
# - force Git to accept working on a repository owned by someone else
RUN sed -i '/secure_path/d' /etc/sudoers && \
userdel -r ubuntu && \
echo "[safe]\n directory = /work" >> /etc/gitconfig

# Install a script that provides information about the ODK and its tools
COPY scripts/odk-info.sh /tools/odk-info
RUN chmod 755 /tools/odk-info
COPY --chmod=755 scripts/odk-info.sh /tools/odk-info
RUN sed -i s/@@ODK_IMAGE_VERSION@@/$ODK_VERSION/ /tools/odk-info

# Install the ODK itself.
COPY odk/make-release-assets.py /tools
COPY odk/odk.py /tools
COPY --chmod=755 odk/make-release-assets.py odk/odk.py /tools
COPY template/ /tools/templates/
RUN chmod 755 /tools/*.py /tools/check-rdfxml
CMD python3 /tools/odk.py

0 comments on commit 7da6b03

Please sign in to comment.