Skip to content

Commit 4792bc2

Browse files
FIX: Ensure USER has permissions for chmod in Dockerfile (#26)
* FIX: Ensure USER has permissions for chmod in Dockerfile * For security reasons the default user in mambaorg/micromamba:1.4.9-bullseye-slim is non-root with uid 1000 (mambauser) but this requires the user permissions to be escalated to one with chmod powers. The simplest way to do this is to chown to mambauser on COPY. * To ensure that the micromamba environment is setup correctly on entry fallback to the mambaorg/micromamba's base image ENTRYPOINT and set this action's /entrypoint.sh as CMD. - c.f. https://github.com/mamba-org/micromamba-docker/blob/604ebafb09543a3d852e437886f1c782f0367911/_entrypoint.sh * MNT: Rename action's script from entrypoint.sh to cmd.sh for clarity * As the action is relying on the mambaorg/micromamba container's entrypoint to setup the shell environment correctly let this be clearly the ENTRYPOINT and rename the action's entrypoint script to cmd.sh as it is being passed as CMD.
1 parent e09d83f commit 4792bc2

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

Dockerfile

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,21 @@
11
FROM mambaorg/micromamba:1.4.9-bullseye-slim
22

3+
USER mambauser
4+
35
SHELL [ "/bin/bash", "-c" ]
46

57
# Use C.UTF-8 locale to avoid issues with unicode encoding
68
ENV LC_ALL=C.UTF-8
79
ENV LANG=C.UTF-8
810

9-
COPY entrypoint.sh /entrypoint.sh
10-
RUN chmod +x /entrypoint.sh
11+
COPY --chown=mambauser cmd.sh /cmd.sh
12+
RUN chmod +x /cmd.sh
1113

12-
ENTRYPOINT ["/entrypoint.sh"]
14+
# The mambaorg/micromamba base image's entrypoint is
15+
# /usr/local/bin/_entrypoint.sh which ensures the shell environment is
16+
# correctly set for micromamba to be accessible by the given user.
17+
# c.f. https://github.com/mamba-org/micromamba-docker/blob/604ebafb09543a3d852e437886f1c782f0367911/_entrypoint.sh
18+
# Instead of replicating this, continue to use it as the ENTRYPOINT
19+
# and then pass the action's script as CMD.
20+
ENTRYPOINT [ "/usr/local/bin/_entrypoint.sh" ]
21+
CMD [ "/cmd.sh" ]

entrypoint.sh renamed to cmd.sh

File renamed without changes.

0 commit comments

Comments
 (0)