openwrt编译Dockerfile

一、Dockerfile

FROM ubuntu:20.04


ENV TZ=Asia/Shanghai

RUN apt-get update && \
    apt-get install -y --no-install-recommends tzdata && \
    ln -fs /usr/share/zoneinfo/$TZ /etc/localtime && \
    dpkg-reconfigure --frontend noninteractive tzdata && \
    apt-get install -y --no-install-recommends \
        ack antlr3 asciidoc autoconf automake autopoint binutils bison build-essential \
        bzip2 ccache cmake cpio curl device-tree-compiler fastjar flex gawk gettext gcc-multilib g++-multilib \
        git gperf haveged help2man intltool libc6-dev-i386 libelf-dev libfuse-dev libglib2.0-dev libgmp3-dev \
        libltdl-dev libmpc-dev libmpfr-dev libncurses5-dev libncursesw5-dev libpython3-dev libreadline-dev \
        libssl-dev libtool lrzsz mkisofs msmtp ninja-build p7zip p7zip-full patch pkgconf python2.7 python3 \
        python3-pyelftools python3-setuptools qemu-utils rsync scons squashfs-tools subversion swig texinfo \
        uglifyjs upx-ucl unzip vim wget xmlto xxd zlib1g-dev sudo && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/*

# RUN groupadd -r openwrt && useradd -r -g openwrt -m -d /home/openwrt openwrt

# RUN chown -R openwrt:openwrt /home/openwrt

# 创建非root用户并设置密码
ARG USERNAME=openwrt
ARG PASSWORD=1
RUN useradd  -m -s /bin/bash $USERNAME \
    && echo "$USERNAME:$PASSWORD" | chpasswd \
    && usermod -aG sudo $USERNAME

# 设置root用户密码
ARG ROOT_PASSWORD=1
RUN echo "root:$ROOT_PASSWORD" | chpasswd

RUN echo "alias ls='ls --color=auto'" >> /etc/bash.bashrc \
    && echo "PS1='\[\e[32m\]\u@\h:\w$\[\e[m\] '" >> /etc/bash.bashrc

USER $USERNAME
WORKDIR /home/$USERNAME
    

ENV FORCE_UNSAFE_CONFIGURE=1

CMD ["/bin/bash"]

二、Build

docker build -t openwrt_compile:1.0.0 .

三、Run

docker run -ti --name "led" -v $(pwd):/home/openwrt  openwrt_compile:1.0.0
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值