当前位置:   article > 正文

openwrt编译Dockerfile

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"]
  • 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

二、Build

docker build -t openwrt_compile:1.0.0 .
  • 1

三、Run

docker run -ti --name "led" -v $(pwd):/home/openwrt  openwrt_compile:1.0.0
  • 1
声明:本文内容由网友自发贡献,转载请注明出处:【wpsshop博客】
推荐阅读
相关标签
  

闽ICP备14008679号