-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile.base-sh
27 lines (21 loc) · 1.01 KB
/
Dockerfile.base-sh
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
FROM oxyure/base:latest
LABEL com.oxyure.vendor="United Microbiotas" \
maintainer="stef@oxyure.com" \
description="Alpine + OpenRC + sudo, /bin/sh as entrypoint (user: operator)"
# If password build arguments are empty, a random string will be choosen.
ARG ROOT_PASSWD=""
ARG OPERATOR_PASSWD=""
# Add some information in the MOTD file
RUN sed -i -e "s/{build_date}/$(date)/" \
-e "s/{build_host}/$(uname -rs)/" /etc/motd
# Change some passwords (do not leave them empty)
RUN if [ -z "${ROOT_PASSWD}" ]; then echo "root:$(echo $RANDOM |sha512sum |cut -d' ' -f1)" | chpasswd; \
else echo "root:${ROOT_PASSWD}" | chpasswd; fi &&\
if [ -z "${OPERATOR_PASSWD}" ]; then echo "operator:$(echo $RANDOM |sha512sum |cut -d' ' -f1)" | chpasswd; \
else echo "operator:${OPERATOR_PASSWD}" | chpasswd; fi
# Remove APK indexes (needed in case we would use APK above)
# RUN rm /var/cache/apk/APKINDEX.*.tar.gz
# Run a shell as user operator.
WORKDIR /home/operator
USER operator
ENTRYPOINT ["/bin/sh"]