├── Dockerfile ├── config ├── mini-packages.config ├── platform.config ├── repositories.conf └── normal-packages.config ├── files ├── etc │ ├── rc.local │ ├── uci-defaults │ │ └── 99-init-settings │ ├── config │ │ ├── network │ │ └── dhcp │ ├── firewall.user │ └── opkg │ │ └── distfeeds.conf └── root │ └── .zshrc ├── .github └── workflows │ ├── delete-workflows.yml │ └── multi-arch.yml ├── scripts └── preset-terminal-tools.sh ├── LICENSE └── README.md /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM scratch 2 | 3 | LABEL org.opencontainers.image.authors="SuLingGG" 4 | 5 | ADD *.tar.gz / 6 | -------------------------------------------------------------------------------- /config/mini-packages.config: -------------------------------------------------------------------------------- 1 | -luci-app-cpufreq 2 | bash 3 | curl 4 | htop 5 | luci-i18n-base-zh-cn 6 | luci-i18n-filetransfer-zh-cn 7 | luci-i18n-turboacc-zh-cn 8 | nano 9 | vim-full -------------------------------------------------------------------------------- /files/etc/rc.local: -------------------------------------------------------------------------------- 1 | # Put your custom commands here that should be executed once 2 | # the system init finished. By default this file does nothing. 3 | 4 | # Fix Luci Don't Remove!! 5 | umount /etc/resolv.conf 6 | rm /etc/resolv.conf 7 | ln -s /tmp/resolv.conf.auto /etc/resolv.conf 8 | 9 | exit 0 10 | -------------------------------------------------------------------------------- /.github/workflows/delete-workflows.yml: -------------------------------------------------------------------------------- 1 | name: Delete Workflows 2 | 3 | on: 4 | workflow_dispatch: 5 | 6 | schedule: 7 | - cron: 0 0 * * * 8 | 9 | jobs: 10 | del_runs: 11 | runs-on: ubuntu-latest 12 | steps: 13 | - name: Delete Workflow Runs 14 | uses: GitRML/delete-workflow-runs@main 15 | with: 16 | token: ${{ secrets.GITHUB_TOKEN }} 17 | retain_days: 3 18 | -------------------------------------------------------------------------------- /files/etc/uci-defaults/99-init-settings: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #================================================= 3 | # File name: init-settings.sh 4 | # Description: This script will be executed during the first boot 5 | # Author: SuLingGG 6 | # Blog: https://mlapp.cn 7 | #================================================= 8 | 9 | # Set default theme to luci-theme-argon 10 | uci set luci.main.mediaurlbase='/luci-static/argon' 11 | 12 | exit 0 13 | -------------------------------------------------------------------------------- /files/etc/config/network: -------------------------------------------------------------------------------- 1 | 2 | config interface 'loopback' 3 | option ifname 'lo' 4 | option proto 'static' 5 | option ipaddr '127.0.0.1' 6 | option netmask '255.0.0.0' 7 | 8 | config globals 'globals' 9 | 10 | config interface 'lan' 11 | option type 'bridge' 12 | option ifname 'eth0' 13 | option proto 'static' 14 | option netmask '255.255.255.0' 15 | option ip6assign '60' 16 | option ipaddr '192.168.123.100' 17 | option gateway '192.168.123.1' 18 | option dns '192.168.123.1' 19 | 20 | config interface 'vpn0' 21 | option ifname 'tun0' 22 | option proto 'none' 23 | 24 | -------------------------------------------------------------------------------- /files/etc/firewall.user: -------------------------------------------------------------------------------- 1 | # This file is interpreted as shell script. 2 | # Put your custom iptables rules here, they will 3 | # be executed with each firewall (re-)start. 4 | 5 | # Internal uci firewall chains are flushed and recreated on reload, so 6 | # put custom rules into the root chains e.g. INPUT or FORWARD or into the 7 | # special user chains, e.g. input_wan_rule or postrouting_lan_rule. 8 | iptables -t nat -A PREROUTING -p udp --dport 53 -j REDIRECT --to-ports 53 9 | iptables -t nat -A PREROUTING -p tcp --dport 53 -j REDIRECT --to-ports 53 10 | iptables -t nat -I POSTROUTING -o eth0 -j MASQUERADE 11 | -------------------------------------------------------------------------------- /files/etc/opkg/distfeeds.conf: -------------------------------------------------------------------------------- 1 | src/gz openwrt_core https://openwrt.cc/snapshots/targets/DEVICE_TARGET/DEVICE_SUBTARGET/packages 2 | src/gz openwrt_kmods https://openwrt.cc/snapshots/targets/DEVICE_TARGET/DEVICE_SUBTARGET/kmods/KERNEL_VERSION 3 | src/gz openwrt_base https://openwrt.cc/snapshots/packages/DEVICE_PLATFORM/base 4 | src/gz openwrt_luci https://openwrt.cc/snapshots/packages/DEVICE_PLATFORM/luci 5 | src/gz openwrt_packages https://openwrt.cc/snapshots/packages/DEVICE_PLATFORM/packages 6 | src/gz openwrt_routing https://openwrt.cc/snapshots/packages/DEVICE_PLATFORM/routing 7 | src/gz openwrt_telephony https://openwrt.cc/snapshots/packages/DEVICE_PLATFORM/telephony 8 | -------------------------------------------------------------------------------- /config/platform.config: -------------------------------------------------------------------------------- 1 | aarch64_cortex-a53/armvirt/64/linux-arm64/armv8 2 | aarch64_cortex-a53/bcm27xx/bcm2710/linux-arm64/rpi3 3 | aarch64_cortex-a72/bcm27xx/bcm2711/linux-arm64/rpi4 4 | aarch64_generic/rockchip/armv8/linux-arm64 5 | arm_arm1176jzf-s_vfp/bcm27xx/bcm2708/linux-arm-v6/rpi1 6 | arm_arm926ej-s/at91/sam9x/linux-arm-v7 7 | arm_cortex-a15_neon-vfpv4/armvirt/32/linux-arm-v7/armv7 8 | arm_cortex-a5_vfpv4/at91/sama5/linux-arm-v7 9 | arm_cortex-a7/mediatek/mt7629/linux-arm-v7 10 | arm_cortex-a7_neon-vfpv4/bcm27xx/bcm2709/linux-arm-v7/rpi2 11 | arm_cortex-a9/bcm53xx/generic/linux-arm-v7 12 | arm_cortex-a9_vfpv3-d16/mvebu/cortexa9/linux-arm-v7 13 | i386_pentium4/x86/generic/linux-386/386 14 | x86_64/x86/64/linux-amd64/amd64 -------------------------------------------------------------------------------- /scripts/preset-terminal-tools.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #================================================= 3 | # File name: preset-terminal-tools.sh 4 | # System Required: Linux 5 | # Version: 1.0 6 | # Lisence: MIT 7 | # Author: SuLingGG 8 | # Blog: https://mlapp.cn 9 | #================================================= 10 | 11 | mkdir -p files/root 12 | pushd files/root 13 | 14 | ## Install oh-my-zsh 15 | # Clone oh-my-zsh repository 16 | git clone https://github.com/robbyrussell/oh-my-zsh ./.oh-my-zsh 17 | 18 | # Install extra plugins 19 | git clone https://github.com/zsh-users/zsh-autosuggestions ./.oh-my-zsh/custom/plugins/zsh-autosuggestions 20 | git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ./.oh-my-zsh/custom/plugins/zsh-syntax-highlighting 21 | git clone https://github.com/zsh-users/zsh-completions ./.oh-my-zsh/custom/plugins/zsh-completions 22 | 23 | popd 24 | -------------------------------------------------------------------------------- /config/repositories.conf: -------------------------------------------------------------------------------- 1 | ## Place your custom repositories here, they must match the architecture and version. 2 | # src/gz %n %U 3 | # src custom file:///usr/src/openwrt/bin/%T/packages 4 | 5 | src/gz openwrt_core https://storage.openwrt.cc/snapshots/targets/DEVICE_TARGET/DEVICE_SUBTARGET/packages 6 | src/gz openwrt_base https://storage.openwrt.cc/snapshots/packages/DEVICE_PLATFORM/base 7 | src/gz openwrt_luci https://storage.openwrt.cc/snapshots/packages/DEVICE_PLATFORM/luci 8 | src/gz openwrt_packages https://storage.openwrt.cc/snapshots/packages/DEVICE_PLATFORM/packages 9 | src/gz openwrt_routing https://storage.openwrt.cc/snapshots/packages/DEVICE_PLATFORM/routing 10 | src/gz openwrt_telephony https://storage.openwrt.cc/snapshots/packages/DEVICE_PLATFORM/telephony 11 | 12 | ## This is the local package repository, do not remove! 13 | src imagebuilder file:packages 14 | 15 | option check_signature -------------------------------------------------------------------------------- /files/etc/config/dhcp: -------------------------------------------------------------------------------- 1 | 2 | config dnsmasq 3 | option domainneeded '1' 4 | option boguspriv '1' 5 | option filterwin2k '0' 6 | option localise_queries '1' 7 | option rebind_protection '1' 8 | option rebind_localhost '1' 9 | option local '/lan/' 10 | option domain 'lan' 11 | option expandhosts '1' 12 | option nonegcache '0' 13 | option authoritative '1' 14 | option readethers '1' 15 | option leasefile '/tmp/dhcp.leases' 16 | option nonwildcard '1' 17 | option localservice '1' 18 | option filter_aaaa '1' 19 | option port '53' 20 | option resolvfile '/tmp/resolv.conf.d/resolv.conf.auto' 21 | option noresolv '0' 22 | 23 | config dhcp 'lan' 24 | option interface 'lan' 25 | option ignore '1' 26 | 27 | config dhcp 'wan' 28 | option interface 'wan' 29 | option ignore '1' 30 | 31 | config srvhost 32 | option srv '_vlmcs._tcp' 33 | option target 'OpenWrt' 34 | option port '1688' 35 | option class '0' 36 | option weight '100' 37 | 38 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 P3TERX 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /config/normal-packages.config: -------------------------------------------------------------------------------- 1 | -luci-app-cpufreq 2 | htop 3 | luci-app-argon-config 4 | luci-app-aria2 5 | luci-app-commands 6 | luci-app-ddns 7 | luci-app-fileassistant 8 | luci-app-filetransfer 9 | luci-app-firewall 10 | luci-app-frpc 11 | luci-app-gowebdav 12 | luci-app-n2n_v2 13 | luci-app-netdata 14 | luci-app-nlbwmon 15 | luci-app-nps 16 | luci-app-openclash 17 | luci-app-passwall 18 | luci-app-samba 19 | luci-app-serverchan 20 | luci-app-smartdns 21 | luci-app-softethervpn 22 | luci-app-ssr-plus 23 | luci-app-transmission 24 | luci-app-ttyd 25 | luci-app-webadmin 26 | luci-app-wireguard 27 | luci-app-wrtbwmon 28 | luci-app-zerotier 29 | luci-base 30 | luci-compat 31 | luci-i18n-argon-config-zh-cn 32 | luci-i18n-aria2-zh-cn 33 | luci-i18n-base-zh-cn 34 | luci-i18n-commands-zh-cn 35 | luci-i18n-ddns-zh-cn 36 | luci-i18n-filetransfer-zh-cn 37 | luci-i18n-firewall-zh-cn 38 | luci-i18n-frpc-zh-cn 39 | luci-i18n-gowebdav-zh-cn 40 | luci-i18n-n2n_v2-zh-cn 41 | luci-i18n-netdata-zh-cn 42 | luci-i18n-nlbwmon-zh-cn 43 | luci-i18n-nps-zh-cn 44 | luci-i18n-passwall-zh-cn 45 | luci-i18n-samba-zh-cn 46 | luci-i18n-smartdns-zh-cn 47 | luci-i18n-softethervpn-zh-cn 48 | luci-i18n-ssr-plus-zh-cn 49 | luci-i18n-transmission-zh-cn 50 | luci-i18n-ttyd-zh-cn 51 | luci-i18n-turboacc-zh-cn 52 | luci-i18n-webadmin-zh-cn 53 | luci-i18n-wireguard-zh-cn 54 | luci-i18n-wrtbwmon-zh-cn 55 | luci-i18n-zerotier-zh-cn 56 | luci-theme-argonv3 57 | luci-theme-material 58 | ariang 59 | coremark 60 | ddns-scripts 61 | ddns-scripts_aliyun 62 | ddns-scripts_cloudflare.com-v4 63 | ddns-scripts_cnkuai_cn 64 | ddns-scripts_digitalocean.com-v2 65 | ddns-scripts_dnspod 66 | ddns-scripts_freedns_42_pl 67 | ddns-scripts_godaddy.com-v1 68 | ddns-scripts_no-ip_com 69 | ddns-scripts_nsupdate 70 | ddns-scripts_route53-v1 71 | iperf 72 | libcap 73 | libcap-bin 74 | rsync 75 | rsyncd 76 | bind-dig 77 | bind-host 78 | openssh-sftp-client 79 | openssh-sftp-server 80 | xl2tpd 81 | ppp-mod-pptp 82 | bsdtar 83 | bzip2 84 | gzip 85 | unzip 86 | lsblk 87 | lscpu 88 | nano 89 | vim-full 90 | zsh 91 | screen 92 | tmate 93 | tmux 94 | tree 95 | whereis -------------------------------------------------------------------------------- /files/root/.zshrc: -------------------------------------------------------------------------------- 1 | # If you come from bash you might have to change your $PATH. 2 | # export PATH=$HOME/bin:/usr/local/bin:$PATH 3 | 4 | # Path to your oh-my-zsh installation. 5 | export ZSH=$HOME/.oh-my-zsh 6 | 7 | # Set name of the theme to load --- if set to "random", it will 8 | # load a random theme each time oh-my-zsh is loaded, in which case, 9 | # to know which specific one was loaded, run: echo $RANDOM_THEME 10 | # See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes 11 | ZSH_THEME="ys" 12 | 13 | # Set list of themes to pick from when loading at random 14 | # Setting this variable when ZSH_THEME=random will cause zsh to load 15 | # a theme from this variable instead of looking in $ZSH/themes/ 16 | # If set to an empty array, this variable will have no effect. 17 | # ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" ) 18 | 19 | # Uncomment the following line to use case-sensitive completion. 20 | # CASE_SENSITIVE="true" 21 | 22 | # Uncomment the following line to use hyphen-insensitive completion. 23 | # Case-sensitive completion must be off. _ and - will be interchangeable. 24 | # HYPHEN_INSENSITIVE="true" 25 | 26 | # Uncomment the following line to disable bi-weekly auto-update checks. 27 | DISABLE_AUTO_UPDATE="true" 28 | 29 | # Uncomment the following line to automatically update without prompting. 30 | # DISABLE_UPDATE_PROMPT="true" 31 | 32 | # Uncomment the following line to change how often to auto-update (in days). 33 | # export UPDATE_ZSH_DAYS=13 34 | 35 | # Uncomment the following line if pasting URLs and other text is messed up. 36 | # DISABLE_MAGIC_FUNCTIONS="true" 37 | 38 | # Uncomment the following line to disable colors in ls. 39 | # DISABLE_LS_COLORS="true" 40 | 41 | # Uncomment the following line to disable auto-setting terminal title. 42 | # DISABLE_AUTO_TITLE="true" 43 | 44 | # Uncomment the following line to enable command auto-correction. 45 | # ENABLE_CORRECTION="true" 46 | 47 | # Uncomment the following line to display red dots whilst waiting for completion. 48 | # COMPLETION_WAITING_DOTS="true" 49 | 50 | # Uncomment the following line if you want to disable marking untracked files 51 | # under VCS as dirty. This makes repository status check for large repositories 52 | # much, much faster. 53 | # DISABLE_UNTRACKED_FILES_DIRTY="true" 54 | 55 | # Uncomment the following line if you want to change the command execution time 56 | # stamp shown in the history command output. 57 | # You can set one of the optional three formats: 58 | # "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd" 59 | # or set a custom format using the strftime function format specifications, 60 | # see 'man strftime' for details. 61 | # HIST_STAMPS="mm/dd/yyyy" 62 | 63 | # Would you like to use another custom folder than $ZSH/custom? 64 | # ZSH_CUSTOM=/path/to/new-custom-folder 65 | 66 | # Which plugins would you like to load? 67 | # Standard plugins can be found in $ZSH/plugins/ 68 | # Custom plugins may be added to $ZSH_CUSTOM/plugins/ 69 | # Example format: plugins=(rails git textmate ruby lighthouse) 70 | # Add wisely, as too many plugins slow down shell startup. 71 | plugins=(git command-not-found extract z docker zsh-syntax-highlighting zsh-autosuggestions zsh-completions) 72 | 73 | source $ZSH/oh-my-zsh.sh 74 | 75 | # User configuration 76 | 77 | # export MANPATH="/usr/local/man:$MANPATH" 78 | 79 | # You may need to manually set your language environment 80 | # export LANG=en_US.UTF-8 81 | 82 | # Preferred editor for local and remote sessions 83 | # if [[ -n $SSH_CONNECTION ]]; then 84 | # export EDITOR='vim' 85 | # else 86 | # export EDITOR='mvim' 87 | # fi 88 | 89 | # Compilation flags 90 | # export ARCHFLAGS="-arch x86_64" 91 | 92 | # Set personal aliases, overriding those provided by oh-my-zsh libs, 93 | # plugins, and themes. Aliases can be placed here, though oh-my-zsh 94 | # users are encouraged to define aliases within the ZSH_CUSTOM folder. 95 | # For a full list of active aliases, run `alias`. 96 | # 97 | # Example aliases 98 | # alias zshconfig="mate ~/.zshrc" 99 | # alias ohmyzsh="mate ~/.oh-my-zsh" 100 | 101 | autoload -U compinit && compinit 102 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # [OpenWrt-Docker](https://github.com/SuLingGG/OpenWrt-Docker) 2 | 3 | [![GitHub Stars](https://img.shields.io/github/stars/SuLingGG/OpenWrt-Rpi-Docker.svg?style=flat-square&label=Stars&logo=github)](https://github.com/SuLingGG/OpenWrt-Rpi-Docker/stargazers) 4 | [![GitHub Forks](https://img.shields.io/github/forks/SuLingGG/OpenWrt-Rpi-Docker.svg?style=flat-square&label=Forks&logo=github)](https://github.com/SuLingGG/OpenWrt-Rpi-Docker/fork) 5 | [![Docker Stars](https://img.shields.io/docker/stars/sulinggg/openwrt.svg?style=flat-square&label=Stars&logo=docker)](https://hub.docker.com/r/sulinggg/openwrt) 6 | [![Docker Pulls](https://img.shields.io/docker/pulls/sulinggg/openwrt.svg?style=flat-square&label=Pulls&logo=docker&color=orange)](https://hub.docker.com/r/sulinggg/openwrt) 7 | 8 | 本项目旨在构建适用于树莓派 1~4 、适用于 armv6/armv7/armv8(aarch64)/x86_64(amd64) 平台设备的 OpenWrt 镜像 (每日更新)。 9 | 10 | Github: 11 | 12 | DockerHub: 13 | 14 | ## 支持设备及镜像版本 15 | 16 | 本项目基于 [immortalwrt: openwrt-18.06-k5.4](https://github.com/immortalwrt/immortalwrt/tree/openwrt-18.06-k5.4),每日上午 8 点编译 OpenWrt 镜像,镜像构建完成后将同时推送到 [DockerHub](https://hub.docker.com/r/sulinggg/openwrt) 和 阿里云镜像仓库 (上海) 。 17 | 18 | 对于国内用户,为提高镜像拉取体验,可以考虑拉取存放于阿里云镜像仓库的镜像,镜像名称及标签如下表所示: 19 | 20 | ### OpenWrt 标准镜像 21 | 22 | OpenWrt 标准镜像为集成常用软件包的 Docker 镜像,镜像自带软件包可满足大多数情景下的使用需求。 23 | 24 | | 支持设备/平台 | DockerHub | 阿里云镜像仓库 (上海) | 25 | | :-------------: | :---------------------: | :-----------------------------------------------------: | 26 | | 树莓派 1B | sulinggg/openwrt:rpi1 | registry.cn-shanghai.aliyuncs.com/suling/openwrt:rpi1 | 27 | | 树莓派 2B | sulinggg/openwrt:rpi2 | registry.cn-shanghai.aliyuncs.com/suling/openwrt:rpi2 | 28 | | 树莓派 3B / 3B+ | sulinggg/openwrt:rpi3 | registry.cn-shanghai.aliyuncs.com/suling/openwrt:rpi3 | 29 | | 树莓派 4B | sulinggg/openwrt:rpi4 | registry.cn-shanghai.aliyuncs.com/suling/openwrt:rpi4 | 30 | | armv7 | sulinggg/openwrt:armv7 | registry.cn-shanghai.aliyuncs.com/suling/openwrt:armv7 | 31 | | arm8/aarch64 | sulinggg/openwrt:armv8 | registry.cn-shanghai.aliyuncs.com/suling/openwrt:armv8 | 32 | | x86_64/amd64 | sulinggg/openwrt:x86_64 | registry.cn-shanghai.aliyuncs.com/suling/openwrt:x86_64 | 33 | 34 | ### OpenWrt-Mini 镜像 35 | 36 | OpenWrt-Mni 镜像为几乎未添加额外软件包的 Docker 镜像,你可以自行通过 opkg 安装你需要的软件包。 37 | 38 | | 支持设备/平台 | DockerHub | 阿里云镜像仓库 (上海) | 39 | | :-------------: | :---------------------: | :-----------------------------------------------------: | 40 | | 树莓派 1B | sulinggg/openwrt-mini:rpi1 | registry.cn-shanghai.aliyuncs.com/suling/openwrt-mini:rpi1 | 41 | | 树莓派 2B | sulinggg/openwrt-mini:rpi2 | registry.cn-shanghai.aliyuncs.com/suling/openwrt-mini:rpi2 | 42 | | 树莓派 3B / 3B+ | sulinggg/openwrt-mini:rpi3 | registry.cn-shanghai.aliyuncs.com/suling/openwrt-mini:rpi3 | 43 | | 树莓派 4B | sulinggg/openwrt-mini:rpi4 | registry.cn-shanghai.aliyuncs.com/suling/openwrt-mini:rpi4 | 44 | | armv7 | sulinggg/openwrt-mini:armv7 | registry.cn-shanghai.aliyuncs.com/suling/openwrt-mini:armv7 | 45 | | arm8/aarch64 | sulinggg/openwrt-mini:armv8 | registry.cn-shanghai.aliyuncs.com/suling/openwrt-mini:armv8 | 46 | | x86_64/amd64 | sulinggg/openwrt-mini:x86_64 | registry.cn-shanghai.aliyuncs.com/suling/openwrt-mini:x86_64 | 47 | 48 | ## 注意事项 49 | 50 | - 其中,树莓派 2B 镜像同时适用于 2B/3B/3B+/4B 。 51 | - 若拉取镜像时不加任何标签,则将使用 latest 标签拉取镜像,latest 指向的镜像与树莓派 2B 镜像实际上为同一镜像。 52 | - 镜像中软件包的集成情况基本上与 [SuLingGG/OpenWrt-Rpi](SuLingGG/OpenWrt-Rpi) 项目中相同,但在 SuLingGG/OpenWrt-Rpi 项目的基础上,去掉了一些与无线/内核特性强相关的软件包。 53 | - 由于 Docker 容器与宿主机共享内核,所以 Docker 容器的内核特性与宿主机当前的内核特性相同。 54 | - 本项目固件支持 opkg 安装软件包,软件源内有 7000+ 个软件包可供选择。 55 | - (对于高级用户) 某些软件包可能依赖一些特定的内核特性,所以我不保证 opkg 软件源中的所有软件包都可以正常使用。且因为上文所述原因,在 OpenWrt 中安装 kmod 是无效的,如果有需求,请提前在宿主机中提前载入相应的内核模块,例如: 56 | 57 | ``` 58 | modprobe ip6_udp_tunnel 59 | modprobe ip6table_nat 60 | modprobe pppoe 61 | modprobe tun 62 | modprobe udp_tunnel 63 | modprobe xt_TPROXY 64 | ``` 65 | 66 | 镜像详细使用方法请参考博客文章: 67 | 68 | 「在 Docker 中运行 OpenWrt 旁路网关」 69 | 70 | 71 | 72 | ## 鸣谢 73 | 74 | P3TERX/Actions-OpenWrt (本项目基于此项目): 75 | 76 | 77 | 78 | OpenWrt Source Repository: 79 | 80 | 81 | 82 | Lean's OpenWrt source: 83 | 84 | 85 | 86 | CTCGFW's Team: 87 | 88 | -------------------------------------------------------------------------------- /.github/workflows/multi-arch.yml: -------------------------------------------------------------------------------- 1 | #================================================= 2 | # https://github.com/P3TERX/Actions-OpenWrt 3 | # Description: Build OpenWrt using GitHub Actions 4 | # Lisence: MIT 5 | # Author: P3TERX 6 | # Blog: https://p3terx.com 7 | #================================================= 8 | 9 | name: Multi-Arch Images 10 | 11 | env: 12 | PREFIX_URL: https://storage.openwrt.cc/snapshots/targets 13 | 14 | on: 15 | workflow_dispatch: 16 | inputs: 17 | INPUT_TARGET: 18 | description: "Target to build (platform/target/subtarget)" 19 | required: false 20 | default: "all" 21 | schedule: 22 | - cron: 0 0 * * * 23 | 24 | jobs: 25 | Config: 26 | name: Generate Config 27 | runs-on: ubuntu-latest 28 | outputs: 29 | TARGETS: ${{ steps.find-targets.outputs.TARGETS }} 30 | 31 | steps: 32 | - name: Checkout 33 | uses: actions/checkout@main 34 | 35 | - name: Find Targets 36 | id: find-targets 37 | env: 38 | INPUT_TARGET: ${{ github.event.inputs.INPUT_TARGET }} 39 | run: | 40 | if [ "$INPUT_TARGET" = "all" ] || [ "$INPUT_TARGET" = "" ]; then 41 | export TARGETS="$(cat config/platform.config)" 42 | else 43 | export TARGETS="$INPUT_TARGET" 44 | fi 45 | JSON='{"config": ["default"], "targets":[' 46 | FIRST=1 47 | for TARGET in $TARGETS; do 48 | [[ $FIRST -ne 1 ]] && JSON="$JSON"',' 49 | JSON="$JSON"'"'"${TARGET}"'"' 50 | FIRST=0 51 | done 52 | JSON="$JSON"']}' 53 | echo $JSON 54 | echo "::set-output name=TARGETS::$JSON" 55 | 56 | Docker-Images: 57 | name: ${{ matrix.TARGETS }} 58 | needs: [Config] 59 | runs-on: ubuntu-latest 60 | strategy: 61 | fail-fast: false 62 | matrix: ${{fromJson(needs.Config.outputs.TARGETS)}} 63 | 64 | steps: 65 | - name: Checkout 66 | uses: actions/checkout@main 67 | 68 | - name: Initialization Environment 69 | env: 70 | DEBIAN_FRONTEND: noninteractive 71 | run: | 72 | sudo -E apt-get -qq update 73 | sudo -E apt-get -qq install build-essential libncurses5-dev libncursesw5-dev \ 74 | zlib1g-dev gawk git gettext libssl-dev xsltproc rsync wget unzip python3 qemu-utils 75 | 76 | - name: Set Up QEMU 77 | uses: docker/setup-qemu-action@v1 78 | 79 | - name: Set Up Docker Buildx 80 | uses: docker/setup-buildx-action@v1 81 | 82 | - name: Login To DockerHub 83 | uses: docker/login-action@v1 84 | with: 85 | username: ${{ secrets.DOCKERHUB_USERNAME }} 86 | password: ${{ secrets.DOCKERHUB_PWD }} 87 | 88 | - name: Login To Alibaba Cloud Container Registry 89 | run: | 90 | docker login -u ${{ secrets.ALIYUN_USERNAME }} -p ${{ secrets.ALIYUN_PWD }} registry.cn-shanghai.aliyuncs.com 91 | 92 | - name: Generate Variables 93 | id: env 94 | run: | 95 | export DEVICE_PLATFORM=$(echo ${{ matrix.TARGETS }} | awk -F '/' '{print $1}') 96 | echo "DEVICE_PLATFORM=$DEVICE_PLATFORM" >> $GITHUB_ENV 97 | export DEVICE_TARGET=$(echo ${{ matrix.TARGETS }} | awk -F '/' '{print $2}') 98 | echo "DEVICE_TARGET=$DEVICE_TARGET" >> $GITHUB_ENV 99 | export DEVICE_SUBTARGET=$(echo ${{ matrix.TARGETS }} | awk -F '/' '{print $3}') 100 | echo "DEVICE_SUBTARGET=$DEVICE_SUBTARGET" >> $GITHUB_ENV 101 | export DOCKER_IMAGE_ARCH=$(echo ${{ matrix.TARGETS }} | awk -F '/' '{print $4}' | sed 's/-/\//g') 102 | echo "DOCKER_IMAGE_ARCH=$DOCKER_IMAGE_ARCH" >> $GITHUB_ENV 103 | export DOCKER_EXTERA_TAG=$(echo ${{ matrix.TARGETS }} | awk -F '/' '{print $5}') 104 | echo "DOCKER_EXTERA_TAG=$DOCKER_EXTERA_TAG" >> $GITHUB_ENV 105 | 106 | - name: Download Image Builder 107 | run: | 108 | wget -q $PREFIX_URL/$DEVICE_TARGET/$DEVICE_SUBTARGET/immortalwrt-imagebuilder-$DEVICE_TARGET-$DEVICE_SUBTARGET.Linux-x86_64.tar.xz 109 | 110 | - name: Set Mini Image Builder 111 | run: | 112 | tar -xJf *.tar.xz 113 | cd immortalwrt-imagebuilder-$DEVICE_TARGET-$DEVICE_SUBTARGET.Linux-x86_64 114 | cp -f $GITHUB_WORKSPACE/config/repositories.conf . 115 | sed -i "s/DEVICE_SUBTARGET/$DEVICE_SUBTARGET/g; \ 116 | s/DEVICE_TARGET/$DEVICE_TARGET/g; \ 117 | s/DEVICE_PLATFORM/$DEVICE_PLATFORM/g" repositories.conf 118 | cp -rf $GITHUB_WORKSPACE/files . 119 | chmod +x files/etc/rc.local 120 | export KERNEL_VERSION="$(ls packages | grep kernel | awk -F '_' '{print $2}')" 121 | sed -i "s/DEVICE_SUBTARGET/$DEVICE_SUBTARGET/g; \ 122 | s/DEVICE_TARGET/$DEVICE_TARGET/g; \ 123 | s/KERNEL_VERSION/$KERNEL_VERSION/g; \ 124 | s/DEVICE_PLATFORM/$DEVICE_PLATFORM/g" files/etc/opkg/distfeeds.conf 125 | 126 | - name: Build Mini RootFS 127 | run: | 128 | cd immortalwrt-imagebuilder-$DEVICE_TARGET-$DEVICE_SUBTARGET.Linux-x86_64 129 | sed -i "/CONFIG_TARGET_ROOTFS_SQUASHFS/s/.*/# CONFIG_TARGET_ROOTFS_SQUASHFS is not set/; 130 | /CONFIG_TARGET_ROOTFS_EXT4FS/s/.*/# CONFIG_TARGET_ROOTFS_EXT4FS is not set/" .config 131 | export CONFIG_MINI_PACKAGES=$(cat $GITHUB_WORKSPACE/config/mini-packages.config | tr -s "\n" " ") 132 | make image PACKAGES="$CONFIG_MINI_PACKAGES" FILES="files" 133 | cp bin/targets/$DEVICE_TARGET/$DEVICE_SUBTARGET/*rootfs.tar.gz $GITHUB_WORKSPACE 134 | cd $GITHUB_WORKSPACE 135 | rm -rf immortalwrt-imagebuilder-$DEVICE_TARGET-$DEVICE_SUBTARGET.Linux-x86_64 136 | 137 | - name: Build & Push Mini Image (Default) 138 | if: env.DOCKER_EXTERA_TAG == null 139 | uses: docker/build-push-action@v2 140 | with: 141 | platforms: ${{ env.DOCKER_IMAGE_ARCH }} 142 | file: Dockerfile 143 | context: . 144 | push: true 145 | tags: | 146 | ${{ secrets.DOCKERHUB_USERNAME }}/openwrt-mini:${{ env.DEVICE_PLATFORM }} 147 | registry.cn-shanghai.aliyuncs.com/${{ secrets.ALIYUN_NAMESPACES }}/openwrt-mini:${{ env.DEVICE_PLATFORM }} 148 | 149 | - name: Build & Push Mini Image (Extra Tag) 150 | if: env.DOCKER_EXTERA_TAG != null 151 | uses: docker/build-push-action@v2 152 | with: 153 | platforms: ${{ env.DOCKER_IMAGE_ARCH }} 154 | file: Dockerfile 155 | context: . 156 | push: true 157 | tags: | 158 | ${{ secrets.DOCKERHUB_USERNAME }}/openwrt-mini:${{ env.DEVICE_PLATFORM }} 159 | ${{ secrets.DOCKERHUB_USERNAME }}/openwrt-mini:${{ env.DOCKER_EXTERA_TAG }} 160 | registry.cn-shanghai.aliyuncs.com/${{ secrets.ALIYUN_NAMESPACES }}/openwrt-mini:${{ env.DEVICE_PLATFORM }} 161 | registry.cn-shanghai.aliyuncs.com/${{ secrets.ALIYUN_NAMESPACES }}/openwrt-mini:${{ env.DOCKER_EXTERA_TAG }} 162 | 163 | - name: Set Normal Image Builder 164 | run: | 165 | tar -xJf *.tar.xz 166 | cd immortalwrt-imagebuilder-$DEVICE_TARGET-$DEVICE_SUBTARGET.Linux-x86_64 167 | cp -f $GITHUB_WORKSPACE/config/repositories.conf . 168 | sed -i "s/DEVICE_SUBTARGET/$DEVICE_SUBTARGET/g; \ 169 | s/DEVICE_TARGET/$DEVICE_TARGET/g; \ 170 | s/DEVICE_PLATFORM/$DEVICE_PLATFORM/g" repositories.conf 171 | cp -rf $GITHUB_WORKSPACE/files . 172 | chmod +x files/etc/rc.local 173 | export KERNEL_VERSION="$(ls packages | grep kernel | awk -F '_' '{print $2}')" 174 | sed -i "s/DEVICE_SUBTARGET/$DEVICE_SUBTARGET/g; \ 175 | s/DEVICE_TARGET/$DEVICE_TARGET/g; \ 176 | s/KERNEL_VERSION/$KERNEL_VERSION/g; \ 177 | s/DEVICE_PLATFORM/$DEVICE_PLATFORM/g" files/etc/opkg/distfeeds.conf 178 | 179 | - name: Build Normal RootFS 180 | run: | 181 | cd immortalwrt-imagebuilder-$DEVICE_TARGET-$DEVICE_SUBTARGET.Linux-x86_64 182 | chmod +x $GITHUB_WORKSPACE/scripts/* 183 | $GITHUB_WORKSPACE/scripts/preset-terminal-tools.sh 184 | sed -i "/CONFIG_TARGET_ROOTFS_SQUASHFS/s/.*/# CONFIG_TARGET_ROOTFS_SQUASHFS is not set/; 185 | /CONFIG_TARGET_ROOTFS_EXT4FS/s/.*/# CONFIG_TARGET_ROOTFS_EXT4FS is not set/" .config 186 | export CONFIG_NORMAL_PACKAGES=$(cat $GITHUB_WORKSPACE/config/normal-packages.config | tr -s "\n" " ") 187 | make image PACKAGES="$CONFIG_NORMAL_PACKAGES" FILES="files" 188 | cp bin/targets/$DEVICE_TARGET/$DEVICE_SUBTARGET/*rootfs.tar.gz $GITHUB_WORKSPACE 189 | cd $GITHUB_WORKSPACE 190 | rm -rf immortalwrt-imagebuilder* 191 | 192 | - name: Build & Push Normal Image (Default) 193 | if: env.DOCKER_EXTERA_TAG == null 194 | uses: docker/build-push-action@v2 195 | with: 196 | platforms: ${{ env.DOCKER_IMAGE_ARCH }} 197 | file: Dockerfile 198 | context: . 199 | push: true 200 | tags: | 201 | ${{ secrets.DOCKERHUB_USERNAME }}/openwrt:${{ env.DEVICE_PLATFORM }} 202 | registry.cn-shanghai.aliyuncs.com/${{ secrets.ALIYUN_NAMESPACES }}/openwrt:${{ env.DEVICE_PLATFORM }} 203 | 204 | - name: Build & Push Normal Image (Extra Tag) 205 | if: env.DOCKER_EXTERA_TAG != null 206 | uses: docker/build-push-action@v2 207 | with: 208 | platforms: ${{ env.DOCKER_IMAGE_ARCH }} 209 | file: Dockerfile 210 | context: . 211 | push: true 212 | tags: | 213 | ${{ secrets.DOCKERHUB_USERNAME }}/openwrt:${{ env.DEVICE_PLATFORM }} 214 | ${{ secrets.DOCKERHUB_USERNAME }}/openwrt:${{ env.DOCKER_EXTERA_TAG }} 215 | registry.cn-shanghai.aliyuncs.com/${{ secrets.ALIYUN_NAMESPACES }}/openwrt:${{ env.DEVICE_PLATFORM }} 216 | registry.cn-shanghai.aliyuncs.com/${{ secrets.ALIYUN_NAMESPACES }}/openwrt:${{ env.DOCKER_EXTERA_TAG }} 217 | --------------------------------------------------------------------------------