refactor: unify sdk and imagebuilder

both setups are similar enough to be unified.

Signed-off-by: Paul Spooren <mail@aparcar.org>
pull/16/head
Paul Spooren 2019-08-02 17:25:15 +02:00
parent bc75894ddc
commit 35cefd1f4f
7 changed files with 17 additions and 63 deletions

View File

@ -21,9 +21,9 @@ RUN apt-get update -qq &&\
&& apt-get -y autoremove && apt-get clean
RUN useradd -c "OpenWrt Builder" -m -d /home/build -s /bin/bash build
COPY --chown=build:build ./sdk /home/build/sdk
RUN chown build:build /home/build/sdk
COPY --chown=build:build . /home/build/openwrt/
RUN chown build:build /home/build/openwrt/
USER build
ENV HOME /home/build
WORKDIR /home/build/sdk
WORKDIR /home/build/openwrt/

View File

@ -1,29 +0,0 @@
FROM debian:latest
MAINTAINER Paul Spooren <mail@aparcar.org>
RUN apt-get update -qq &&\
apt-get install -y \
build-essential \
file \
gawk \
gettext \
git \
libncurses5-dev \
libssl-dev \
python2.7 \
python3 \
subversion \
swig \
unzip \
wget \
zlib1g-dev \
&& apt-get -y autoremove && apt-get clean
RUN useradd -c "OpenWrt Builder" -m -d /home/build -s /bin/bash build
COPY --chown=build:build ./imagebuilder /home/build/imagebuilder
RUN chown build:build /home/build/imagebuilder
USER build
ENV HOME /home/build
WORKDIR /home/build/imagebuilder

View File

@ -2,9 +2,7 @@ FROM scratch
MAINTAINER Paul Spooren <mail@aparcar.org>
ADD ./rootfs-openwrt /
ADD ./rootfs /
ADD ./ /
EXPOSE 80 443 22

View File

@ -12,6 +12,7 @@ if [ ! -f sha256sums.asc ] && [ ! -f sha256sums.sig ]; then
exit 1
fi
[ ! -f sha256sums.asc ] || gpg --with-fingerprint --verify sha256sums.asc sha256sums
if [ -f sha256sums.sig ]; then
VERIFIED=
for KEY in ~/usign/*; do
@ -32,3 +33,8 @@ fi
rsync -av "$FILE_HOST::downloads/$DOWNLOAD_PATH/$DOWNLOAD_FILE" . || exit 1
grep $DOWNLOAD_FILE sha256sums > sha256sums_min
sha256sum -c sha256sums_min
rm -f sha256sums{,_min,.sig,.asc}
mkdir -p ./build
tar xf $DOWNLOAD_FILE --strip=1 -C ./build
rm -rf $DOWNLOAD_FILE

View File

@ -19,13 +19,9 @@ for TARGET in $TARGETS ; do
./docker-download.sh || exit 1
mkdir -p ./imagebuilder
tar Jxf $DOWNLOAD_FILE --strip=1 -C ./imagebuilder
rm -rf $DOWNLOAD_FILE
docker build -t "$DOCKER_IMAGE:$TARGET-$BRANCH" -f Dockerfile ./build
docker build -t "$DOCKER_IMAGE:$TARGET-$BRANCH" -f Dockerfile.imagebuilder .
rm -rf ./imagebuilder
rm -rf ./build
[ -n "$DOCKER_USER" ] && [ -n "$DOCKER_PASS" ] && ./docker-upload.sh || true
done

View File

@ -15,13 +15,11 @@ for TARGET in $TARGETS ; do
./docker-download.sh || exit 1
mkdir -p ./rootfs-openwrt
tar xzf $DOWNLOAD_FILE -C ./rootfs-openwrt
rm -rf $DOWNLOAD_FILE
cp -r ./rootfs/* ./build
docker build -t "$DOCKER_IMAGE:$TARGET-$BRANCH" -f Dockerfile.rootfs .
docker build -t "$DOCKER_IMAGE:$TARGET-$BRANCH" -f Dockerfile.rootfs ./build
rm -rf ./rootfs-openwrt
rm -rf ./build
[ -n "$DOCKER_USER" ] && [ -n "$DOCKER_PASS" ] && ./docker-upload.sh || true
done

View File

@ -11,30 +11,15 @@ for TARGET in $TARGETS ; do
for BRANCH in $BRANCHES; do
if [ "$BRANCH" == "master" ]; then
export DOWNLOAD_PATH="snapshots/targets/$(echo $TARGET | tr '-' '/')"
BRANCH_FEEDS="$BRANCH"
else
export DOWNLOAD_PATH="releases/$BRANCH/targets/$(echo $TARGET | tr '-' '/')"
BRANCH_FEEDS="openwrt-$BRANCH"
fi
./docker-download.sh || exit 1
mkdir -p ./sdk
tar Jxf $DOWNLOAD_FILE --strip=1 -C ./sdk
rm -rf $DOWNLOAD_FILE
docker build -t "$DOCKER_IMAGE:$TARGET-$BRANCH" -f Dockerfile ./build
# use GitHub instead of git.openwrt.org
cat > ./sdk/feeds.conf <<EOF
src-git base https://github.com/openwrt/openwrt.git;$BRANCH_FEEDS
src-git packages https://github.com/openwrt/packages.git;$BRANCH_FEEDS
src-git luci https://github.com/openwrt/luci.git;$BRANCH_FEEDS
src-git routing https://github.com/openwrt-routing/packages.git;$BRANCH_FEEDS
src-git telephony https://github.com/openwrt/telephony.git;$BRANCH_FEEDS
EOF
docker build -t "$DOCKER_IMAGE:$TARGET-$BRANCH" -f Dockerfile.sdk .
rm -rf ./sdk
rm -rf ./build
[ -n "$DOCKER_USER" ] && [ -n "$DOCKER_PASS" ] && ./docker-upload.sh || true
done