This repository has been archived by the owner on Sep 8, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Dockerfile
66 lines (57 loc) · 1.46 KB
/
Dockerfile
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
55
56
57
58
59
60
61
62
63
64
65
66
FROM ubuntu:18.04
ARG BUILD_USER=builder
ARG PUID=1000
ARG PGID=1000
ENV BUILD_DIR=/build
ENV VOLUME_DIR=/out
# install dependencies
RUN apt-get update && \
apt-get -y install \
# for admin rights
sudo \
build-essential \
curl \
dosfstools \
e2fsprogs \
git \
# u-boot
gcc-arm-linux-gnueabihf \
bison \
flex \
python-dev \
swig \
xxd \
# openwrt
ecj \
fastjar \
file \
g++ \
gawk \
gettext \
java-propose-classpath \
libelf-dev \
libncurses5-dev \
libssl-dev \
python \
python3 \
python3-distutils \
subversion \
unzip \
wget \
zlib1g-dev
# add build user
RUN [ $(getent group $PGID) ] || groupadd -f -g $PGID $BUILD_USER && \
useradd -ms /bin/bash -u $PUID -g $PGID $BUILD_USER && \
echo "Cmnd_Alias IMAGE_CREATION = /sbin/losetup, /sbin/mkfs.ext4, /sbin/mkfs.vfat, /bin/mount, /bin/umount, /bin/cp, /bin/tar, /bin/mknod" >> /etc/sudoers && \
echo "$BUILD_USER ALL = NOPASSWD: IMAGE_CREATION" >> /etc/sudoers
# setup build context
RUN mkdir "$BUILD_DIR" && \
mkdir "$VOLUME_DIR" && \
chown $PUID:$PGID "$VOLUME_DIR"
ADD . "$BUILD_DIR"
RUN chown -R $PUID:$PGID "$BUILD_DIR"
WORKDIR "$BUILD_DIR"
USER $BUILD_USER
VOLUME "$VOLUME_DIR"
COPY docker_entrypoint.sh /usr/bin/
ENTRYPOINT ["docker_entrypoint.sh"]