Skip to content

Commit

Permalink
Arch Linux: don't make build dir in Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
takano32 committed Jul 10, 2023
1 parent c68de79 commit 4f9e266
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 28 deletions.
24 changes: 6 additions & 18 deletions archlinux/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,33 +1,21 @@
FROM archlinux:latest
LABEL maintainer "TAKANO Mitsuhiro <[email protected]>"

ENV BUILD_DIR=/build-kernel/build

RUN mkdir /build-kernel
RUN mkdir /build-kernel/build
RUN mkdir /build-kernel/zst-pkg

RUN yes | pacman -Sy git

RUN yes | pacman -S asp base-devel
RUN yes | pacman -S pacman-contrib
RUN pacman-db-upgrade
RUN pacman -Syyu --noconfirm

RUN pacman -S --noconfirm git
RUN pacman -S --noconfirm asp base-devel
RUN pacman -S --noconfirm pacman-contrib
RUN pacman -Scc

RUN useradd takano32
RUN mkdir /build-kernel
RUN mkdir /home/takano32
RUN chown -R takano32.takano32 /build-kernel /home/takano32
RUN echo "takano32 ALL=(ALL:ALL) NOPASSWD: ALL" > /etc/sudoers.d/takano32
ENV SUDO="sudo -u takano32"

RUN cd $BUILD_DIR && $SUDO asp update linux
RUN cd $BUILD_DIR && $SUDO asp export linux
RUN cd $BUILD_DIR/linux && $SUDO updpkgsums
RUN cd $BUILD_DIR/linux && yes | $SUDO makepkg -seo
RUN $SUDO git config --global http.version HTTP/1.1
RUN $SUDO git config --global http.postBuffer 524288000
RUN while :; do cd $BUILD_DIR/linux && $SUDO makepkg -o --skippgpcheck && break || sleep 5; done

COPY ./archlinux/entrypoint.sh /
RUN chmod 755 /entrypoint.sh
EXPOSE 8000
Expand Down
24 changes: 14 additions & 10 deletions archlinux/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,28 +1,32 @@
#!/bin/bash
set -eux

BUILD_DIR=/build-kernel/build
SUDO="sudo -u takano32"

chown -R takano32:takano32 /build-kernel/build
$SUDO mkdir -p /build-kernel/build/linux
$SUDO rm -rf /build-kernel/build/linux
$SUDO mkdir -p /build-kernel/build/linux
cd /build-kernel/build/linux
mkdir -p $BUILD_DIR
chown -R takano32:takano32 $BUILD_DIR

cd $BUILD_DIR
$SUDO asp update linux
$SUDO asp export linux
$SUDO cp -a linux/* .
$SUDO rm -rf linux

# `makepkg` in `/build-kernel/bulid/linux`
cd $BUILD_DIR/linux
$SUDO updpkgsums && yes | $SUDO makepkg -seo
$SUDO git config --global http.version HTTP/1.1
$SUDO git config --global http.postBuffer 524288000
while :; do $SUDO makepkg -o --skippgpcheck && break || sleep 5; done

# `makepkg` in `$BUILD_DIR/linux`
$SUDO makepkg --skippgpcheck

cd /build-kernel/build
cd $BUILD_DIR
mv linux/src/archlinux-linux/Documentation/output ../htmldocs
mkdir /build-kernel/zst-pkg
mv linux/*.zst ../zst-pkg
cd ..

if ! "$CI"; then
python3 -m http.server
fi


0 comments on commit 4f9e266

Please sign in to comment.