-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
48 lines (41 loc) · 1.71 KB
/
Dockerfile
File metadata and controls
48 lines (41 loc) · 1.71 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
# base only contains the mininmum to do work with a mount (non-macOS, due to case insentitive filesystem)
FROM debian:12 AS base
# Installing packages: (1) tools (2) OpenWRT deps (3) hidden OpenWRT deps
RUN apt-get update && \
apt-get upgrade -y && \
apt install -y vim tmux ccache sudo git git-doc git-extras git-filter-repo tig bash bash-completion \
build-essential asciidoc bash binutils bzip2 flex git g++ gcc time util-linux gawk gzip help2man intltool libelf-dev zlib1g-dev make libncurses-dev libssl-dev patch perl-modules libthread-queue-any-perl python3-dev swig unzip wget gettext xsltproc zlib1g-dev \
rsync
# Allow NOPASSWD sudo
RUN sed -i /etc/sudoers -re 's/^%sudo.*/%sudo ALL=(ALL:ALL) NOPASSWD: ALL/g'
# Fix locale
ENV LANG=C.UTF-8
ENV LC_ALL=C.UTF-8
ARG BUILD_USER
ARG BUILD_ROOTDIR
ARG BUILD_PROJDIR
ENV BUILD_DIR="/${BUILD_ROOTDIR}/${BUILD_PROJDIR}"
ENV USR=$BUILD_USER
# OpenWRT buildsystem requires non-root user
RUN useradd -ms /bin/bash -G sudo $USR
WORKDIR $BUILD_DIR
RUN chown -R $USR /${BUILD_ROOTDIR}/
USER $USR
# Force theme for visual separation of windows if attached in VSCode
RUN mkdir .vscode
RUN echo '{"workbench.colorTheme": "Solarized Dark"}' > .vscode/settings.json
# builder acts as a from-scratch environment, appropriate for CI or testing
FROM base AS builder
# Minimal copy to allow for maximum caching
COPY --chown=$USR modules ./
COPY --chown=$USR scripts ./scripts
RUN ./scripts/update.sh
# Copy everything else that's important and might change more often
COPY --chown=$USR Makefile ./
COPY --chown=$USR patches ./patches
COPY --chown=$USR .git/ ./.git/
COPY --chown=$USR .gitignore ./
FROM builder AS toolchain
ARG PATCHSET
RUN make $PATCHSET
RUN make toolchain