forked from bargees/barge-os
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
182 lines (163 loc) · 8.6 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
# FROM registry.cn-shenzhen.aliyuncs.com/infrastlabs/barge-build-output:latest as brdata
# FROM registry.cn-shenzhen.aliyuncs.com/infrastlabs/barge-build-output:v2501 as brdata
# v2501-br201908-k54{clean by scripts/build.sh's non-cp}> v2501-br2002-k54
FROM registry.cn-shenzhen.aliyuncs.com/infrastlabs/barge-build-output:v2501-br2002-k54 as brdata
# FROM ubuntu:22.04
# FROM ubuntu:24.04
# FROM registry.cn-shenzhen.aliyuncs.com/infrasync/library-ubuntu:24.04
# FROM ailispaw/ubuntu-essential:16.04-nodoc
# FROM ubuntu:16.04
FROM registry.cn-shenzhen.aliyuncs.com/infrasync/library-ubuntu:16.04
ARG TARGETPLATFORM
# ARG VER=20.04
ARG VER=16.04
ENV TERM=xterm \
# SYSLINUX_SITE=https://mirrors.edge.kernel.org/ubuntu/pool/main/s/syslinux \
SYSLINUX_SITE=https://gitee.com/g-system/fk-barge-os/releases/download/master-2019-08 \
SYSLINUX_VERSION=4.05+dfsg-6+deb8u1
# jammy> noble; xenial
RUN \
#export DOMAIN="mirrors.aliyun.com"; \
export DOMAIN="mirrors.ustc.edu.cn"; \
case ${VER} in \
"14.04") V2=trusty ;; \
"16.04") V2=xenial ;; \
"18.04") V2=bionic ;; \
"20.04") V2=focal ;; \
"22.04") V2=jammy ;; \
"24.04") V2=noble ;; \
esac; \
test -z "$(echo $TARGETPLATFORM |grep arm)" && target=ubuntu || target=ubuntu-ports; \
echo "deb http://${DOMAIN}/$target ${V2} main restricted universe multiverse" > /etc/apt/sources.list \
&& echo "deb http://${DOMAIN}/$target ${V2}-security main restricted universe multiverse" >> /etc/apt/sources.list \
&& echo "deb http://${DOMAIN}/$target ${V2}-updates main restricted universe multiverse">> /etc/apt/sources.list \
&& echo "deb http://${DOMAIN}/$target ${V2}-backports main restricted universe multiverse">> /etc/apt/sources.list; \
echo 'apt update -qq && apt install -yq --no-install-recommends $@ && apt clean; rm -rf /var/lib/apt/lists/* /var/cache/apt/* /var/cache/debconf/* /var/log/*; ' > /usr/local/bin/apt.sh \
&& chmod +x /usr/local/bin/apt.sh;
# ubt16: gcc7?
# ubt22: gcc-11 amd64 11.4.0-1ubuntu1~22.04 [20.1 MB]; g++-11 amd64 11.4.0-1ubuntu1~22.04 [11.4 MB]
# python ##E: Package 'python' has no installation candidate
# ubt1604 without python: make[1]: python3: Command not found @11min
RUN apt-get -q update && \
apt.sh ca-certificates \
bc build-essential cpio file git unzip rsync wget curl \
syslinux syslinux-common isolinux xorriso dosfstools mtools; \
# test: ubt1604 err.
# export VER=${VER}; test "16.04" == "${VER}" && apt.sh python || echo "not-ubt1604, skip python";
case ${VER} in \
"16.04") apt.sh python ;; \
*) echo "VER=${VER} not-ubt1604, skip python"; ;; \
esac;
# wget -q https://mirrors.edge.kernel.org/ubuntu/pool/main/s/syslinux/syslinux-common_4.05+dfsg-6+deb8u1_all.deb
# wget -q https://mirrors.edge.kernel.org/ubuntu/pool/main/s/syslinux/syslinux_4.05+dfsg-6+deb8u1_amd64.deb
RUN \
export SYSLINUX_VERSION2="$(echo $SYSLINUX_VERSION |sed "s/+/%20/g")" && \
export SYSLINUX_VERSION="$(echo $SYSLINUX_VERSION |sed "s/+/ /g")"; \
# https://gitee.com/g-system/fk-barge-os/releases/download/master-2019-08/syslinux_4.05%20dfsg-6%20deb8u1_amd64.deb
# arm64> amd64: none_arm64..(404);
case ${TARGETPLATFORM} in \
"linux/amd64") arch=amd64 ;; \
"linux/arm64") arch=amd64 ;; \
"linux/arm/v7") arch=armv7 ;; \
"linux/arm/v6") arch=NONE_ARMv6 ;; \
"linux/386") arch=NONE_i386 ;; \
*) arch=amd64 ;; \
esac; \
echo ${SYSLINUX_SITE}/syslinux_${SYSLINUX_VERSION2}_$arch.deb; \
wget -q "${SYSLINUX_SITE}/syslinux-common_${SYSLINUX_VERSION2}_all.deb" && \
wget -q "${SYSLINUX_SITE}/syslinux_${SYSLINUX_VERSION2}_$arch.deb" && \
dpkg -i "syslinux-common_${SYSLINUX_VERSION}_all.deb" && \
dpkg -i "syslinux_${SYSLINUX_VERSION}_$arch.deb" && \
rm -f "syslinux-common_${SYSLINUX_VERSION}_all.deb" && \
rm -f "syslinux_${SYSLINUX_VERSION}_$arch.deb" && \
apt-get clean && rm -rf /var/cache/apt/* /var/lib/apt/lists/* /var/cache/debconf/* /var/log/*
##################################################################
# FROM registry.cn-shenzhen.aliyuncs.com/infrastlabs/barge-build-compiler-ubt1604:latest
# Setup environment
# ubt2404: configure: error: you should not run configure as root (set FORCE_UNSAFE_CONFIGURE=1 in environment to bypass this check)
ENV SRC_DIR=/build \
OVERLAY=/overlay \
BR_ROOT=/build/buildroot
# FORCE_UNSAFE_CONFIGURE=1
RUN mkdir -p ${SRC_DIR} ${OVERLAY}
# ENV BR_VERSION 2019.08
# ERROR: The certificate of 'buildroot.org' has expired.
# RUN wget -qO- https://buildroot.org/downloads/buildroot-${BR_VERSION}.tar.bz2 | tar xj && \
# mv buildroot-${BR_VERSION} ${BR_ROOT}
# RUN curl -O -fSL -k https://buildroot.org/downloads/buildroot-${BR_VERSION}.tar.bz2
# RUN tar -jxf buildroot-${BR_VERSION}.tar.bz2; \
# mv buildroot-${BR_VERSION} ${BR_ROOT}
# ENV BR_VERSION 2024.02.10
# ENV BR_VERSION 2019.08
ENV BR_VERSION 2020.02.12
# https://buildroot.org/downloads/buildroot-2024.02.10.tar.xz
# https://buildroot.org/downloads/buildroot-2024.02.10.tar.gz ##bz2: last @buildroot-2021.11-rc3.tar.bz2
# buildroot-2024.02.tar.gz 2024-Mar-05 14:52:59 7.0M application/x-gtar-compressed
# buildroot-2024.02.tar.xz 2024-Mar-05 14:53:08 5.2M application/x-xz
# buildroot-2024.02.10.tar.gz 2025-Jan-09 14:45:56 7.1M application/x-gtar-compressed
# buildroot-2024.11.1.tar.xz 2025-Jan-09 15:53:07 5.4M application/x-xz
RUN curl -O -fSL -k https://buildroot.org/downloads/buildroot-${BR_VERSION}.tar.gz
RUN tar -zxf buildroot-${BR_VERSION}.tar.gz; \
mv buildroot-${BR_VERSION} ${BR_ROOT}
# # Apply patches
# COPY patches ${SRC_DIR}/patches
# RUN for patch in ${SRC_DIR}/patches/*.patch; do \
# patch -p1 -d ${BR_ROOT} < ${patch}; \
# done
# Setup overlay
COPY overlay ${OVERLAY}
WORKDIR ${OVERLAY}
# Add ca-certificates
RUN mkdir -p etc/ssl/certs && \
cp /etc/ssl/certs/ca-certificates.crt etc/ssl/certs/
# Add bash-completion
RUN mkdir -p usr/share/bash-completion/completions && \
#wget -qO usr/share/bash-completion/bash_completion https://raw.githubusercontent.com/scop/bash-completion/master/bash_completion && \
wget -qO usr/share/bash-completion/bash_completion https://gitee.com/g-system/fk-barge-os/releases/download/master-2019-08/bash_completion && \
chmod +x usr/share/bash-completion/bash_completion
# Add Docker bash-completion
ENV DOCKER_VERSION 1.10.3
RUN \
#wget -qO usr/share/bash-completion/completions/docker https://raw.githubusercontent.com/moby/moby/v${DOCKER_VERSION}/contrib/completion/bash/docker
wget -qO usr/share/bash-completion/completions/docker https://gitee.com/g-system/fk-barge-os/releases/download/master-2019-08/completion_docker_v1.10.3
# Add dumb-init
ENV DINIT_VERSION 1.2.2
RUN mkdir -p usr/bin && \
# wget -qO usr/bin/dumb-init https://github.com/Yelp/dumb-init/releases/download/v${DINIT_VERSION}/dumb-init_${DINIT_VERSION}_amd64 && \
wget -qO usr/bin/dumb-init https://gitee.com/g-system/fk-barge-os/releases/download/master-2019-08/dumb-init_1.2.2_amd64 && \
chmod +x usr/bin/dumb-init
# ENV VERSION 2.14.0-rc2
ENV VERSION 2.14.1-2501
RUN mkdir -p etc && \
echo "Welcome to Barge ${VERSION}, Docker version ${DOCKER_VERSION}" > etc/motd && \
echo "NAME=\"Barge\"" > etc/os-release && \
echo "VERSION=${VERSION}" >> etc/os-release && \
echo "ID=barge" >> etc/os-release && \
echo "ID_LIKE=busybox" >> etc/os-release && \
echo "VERSION_ID=${VERSION}" >> etc/os-release && \
echo "PRETTY_NAME=\"Barge ${VERSION}\"" >> etc/os-release && \
echo "HOME_URL=\"https://github.com/bargees/barge-os\"" >> etc/os-release && \
echo "BUG_REPORT_URL=\"https://github.com/bargees/barge-os/issues\"" >> etc/os-release
# Add Package Installer
RUN mkdir -p usr/bin && \
# wget -qO usr/bin/pkg https://raw.githubusercontent.com/bargees/barge-pkg/master/pkg && \
wget -qO usr/bin/pkg https://gitee.com/g-system/fk-barge-os/releases/download/master-2019-08/barge_pkg && \
chmod +x usr/bin/pkg
COPY --from=brdata /output/brdata.tar.gz /output_brdata.tar.gz
# >>> linux 5.4.289 Building
# scripts/extract-cert.c:21:25: fatal error: openssl/bio.h: No such file or directory
RUN apt.sh libssl-dev
# Copy config files
COPY configs ${SRC_DIR}/configs
# RUN cp ${SRC_DIR}/configs/buildroot.config ${BR_ROOT}/.config && \
# cp ${SRC_DIR}/configs/busybox.config ${BR_ROOT}/package/busybox/busybox.config
COPY scripts ${SRC_DIR}/scripts
RUN chmod +x ${SRC_DIR}/scripts/*.sh
VOLUME ${BR_ROOT}/dl ${BR_ROOT}/ccache
# ENV SRC_DIR=/build \
# OVERLAY=/overlay \
# BR_ROOT=/build/buildroot
WORKDIR ${BR_ROOT}
# CMD ["../scripts/build.sh"]
# RUN bash ${BR_ROOT}/../scripts/build_arm.sh
CMD ["../scripts/build_arm.sh"]