-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile.base
54 lines (45 loc) · 1.42 KB
/
Dockerfile.base
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
45
46
47
48
49
50
51
52
53
54
FROM ubuntu:focal
LABEL maintainer="[email protected]"
ARG USER_ID
ARG GROUP_ID
ENV container docker
ENV LANG C.UTF-8
ENV LC_ALL C.UTF-8
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive \
apt-get install -y \
snapd \
build-essential \
git \
curl \
jq \
python2 \
python3 \
python-is-python3 \
lsb-release \
sudo \
vim
COPY cb-start.sh /tmp/cb-start.sh
PATCH_LINE1
PATCH_LINE2
RUN echo "cbuilder ALL=NOPASSWD: ALL" | tee -a /etc/sudoers
# The container does a build that tries to use the host's uids, based on:
# https://jtreminio.com/blog/running-docker-containers-as-current-host-user/#ok-so-what-actually-works
RUN if [ ${USER_ID:-0} -ne 0 ] && [ ${GROUP_ID:-0} -ne 0 ]; then \
if getent passwd cbuilder; then userdel -f cbuilder; fi && \
if getent group cbuilder ; then groupdel cbuilder; fi && \
groupadd -g ${GROUP_ID} cbuilder && \
useradd -l -u ${USER_ID} -g cbuilder cbuilder && \
install -d -m 0755 -o cbuilder -g cbuilder /home/cbuilder && \
chown --changes --silent --no-dereference --recursive \
--from=33:33 ${USER_ID}:${GROUP_ID} \
/tmp/cb-start.sh && \
if [ -f /tmp/patch.diff ]; then \
chown --changes --silent --no-dereference --recursive \
--from=33:33 ${USER_ID}:${GROUP_ID} \
/tmp/patch.diff ;\
fi \
;fi
USER cbuilder
WORKDIR /tmp
ENTRYPOINT [ "/tmp/cb-start.sh" ]