-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
75 lines (59 loc) · 3.07 KB
/
Dockerfile
File metadata and controls
75 lines (59 loc) · 3.07 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
FROM ubuntu:22.04
LABEL maintainer="paldier <paldier@hotmail.com>"
# 使用国内APT镜像源
ARG CHINESE_APT_MIRRORS=1
RUN [ $CHINESE_APT_MIRRORS -eq 1 ] && sed -i s@/archive.ubuntu.com/@/mirrors.aliyun.com/@g /etc/apt/sources.list || true
ENV DEBIAN_FRONTEND noninteractive
ENV TOOLCHAIN_BASE /opt/toolchains
ENV LANG C.UTF-8
ENV TERM xterm-256color
WORKDIR /build
RUN \
# Install latest packages
apt-get -y dist-upgrade && \
apt-get update && \
apt-get -y \
install build-essential asciidoc dos2unix libtool-bin cmake libproxy-dev \
uuid-dev liblzo2-dev autoconf automake bash bison bzip2 diffutils \
file flex m4 g++ gawk groff-base libncurses5-dev libtool libslang2 \
make patch perl pkg-config shtool subversion tar texinfo zlib1g \
zlib1g-dev git gettext libexpat1-dev libssl-dev cvs gperf unzip \
python2 libxml-parser-perl gcc-multilib libxml2-dev g++-multilib \
gitk libncurses5 mtd-utils libvorbis-dev autopoint autogen sed \
intltool libglib2.0-dev xutils-dev \
lib32z1-dev lib32stdc++6 xsltproc gtk-doc-tools libelf-dev \
libelf1 libltdl-dev openssh-server curl nano lzip patchelf \
gosu bc rsync sudo xxd binutils libz-dev patch python3 \
lib32gcc-s1 libc6-dev-i386 uglifyjs git-core p7zip p7zip-full msmtp \
xmlto qemu-utils upx device-tree-compiler antlr3 wget lib32z1 \
binutils-dev lzma liblzma-dev lzma-dev libstdc++5 docbook-xsl-* \
sharutils gengetopt autoconf-archive libsysfs-dev zip && \
# Clean up env
apt -y autoremove && \
apt -y autoclean && \
rm -Rf /var/cache/apt/archives/* && \
# Set bash as default shell
sudo ln -sf /bin/bash /bin/sh && \
sudo mkdir -p /usr/local/share/aclocal/ && \
sudo cp /usr/share/aclocal/*.m4 /usr/local/share/aclocal/ && \
# Set "docker" as root password
echo "root:docker" | chpasswd && \
# Adds docker user
useradd -m docker && \
echo "docker:docker" | chpasswd && adduser docker sudo && \
echo "docker ALL=(ALL:ALL) NOPASSWD: ALL" | sudo tee /etc/sudoers.d/docker && \
# Sets up toolchains
gosu docker bash -c 'cd /home/docker && git clone --depth=1 https://github.com/SWRT-dev/mtk-toolchains && git clone --depth=1 https://github.com/SWRT-dev/qca-toolchains && git clone --depth=1 https://github.com/SWRT-dev/bcmhnd-toolchains && git clone --depth=1 https://github.com/SWRT-dev/bcm-toolchains'
RUN [ $CHINESE_APT_MIRRORS -eq 1 ] && sed -i s@/mirrors.aliyun.com/@/archive.ubuntu.com/@g /etc/apt/sources.list || true
COPY envs /home/docker/envs
RUN chown docker /home/docker/envs/* && \
chmod 755 /home/docker/envs/*
RUN echo '[ ! -z "$TERM" -a -r /etc/motd ] && cat /etc/motd' \
>> /etc/bash.bashrc \
; echo "This Docker image would allow you to build SWRT firmware." > /etc/motd \
; echo "To initialize correctly the env, please run" >> /etc/motd \
; echo " 'source /home/docker/envs/toolchain.sh'" >> /etc/motd \
; echo " 'source /home/docker/envs/bcm.sh'" >> /etc/motd
# Set docker as default
USER docker:docker
CMD ["bash"]