forked from externpro/externpro
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlocal.dockerfile
More file actions
44 lines (44 loc) · 1.34 KB
/
local.dockerfile
File metadata and controls
44 lines (44 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
ARG BPROIMG=rocky85-bld
ARG BPROTAG=latest
FROM ghcr.io/externpro/buildpro/${BPROIMG}:${BPROTAG}
LABEL maintainer="smanders"
LABEL org.opencontainers.image.source=https://github.com/externpro/buildpro
SHELL ["/bin/bash", "-c"]
USER 0
# [COPY|RUN]_IT
ARG COPY_IT
ARG RUN_IT
COPY ${COPY_IT} /usr/local/games
RUN eval "${RUN_IT}"
# tools
ARG TOOLS
ARG TOOLS_PATH
RUN eval "${TOOLS}"
ENV PATH=$PATH${TOOLS_PATH}
# webpro
ARG WEBPRO
RUN eval "${WEBPRO}"
ARG WEBPRO_PATH="${EXTERN_DIR}/webpro*"
ENV WEBPRO_PATH=${WEBPRO_PATH}
# timezone
ARG TZ
ENV TZ=$TZ
# create non-root user, add to sudoers
ARG USERNAME
ARG USERID
ARG GROUPID
RUN if [ ${USERID:-0} -ne 0 ] && [ ${GROUPID:-0} -ne 0 ]; then \
export GROUPNAME=$(getent group ${GROUPID} | cut -d: -f1) \
&& if [[ -z ${GROUPNAME} ]]; then groupadd -g ${GROUPID} ${USERNAME}; fi \
&& useradd --create-home --shell /bin/bash --no-log-init --uid ${USERID} --gid ${GROUPID} ${USERNAME} \
&& echo "" >> /etc/sudoers \
&& echo "## dockerfile adds ${USERNAME} to sudoers" >> /etc/sudoers \
&& echo "${USERNAME} ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers \
&& unset GROUPNAME \
; fi
ENV USER=${USERNAME}
# run container as non-root user from here onwards
# so that build output files have the correct owner
USER ${USERNAME}
# run bash script and process the input command
ENTRYPOINT ["/bin/bash", "/usr/local/bpbin/entry.sh"]