树莓派容器构建备忘
2020-03-08 tech linux raspberry-pi docker 5 mins 2081 字
由于树莓派是 ARM 芯片,大部分镜像都是基于 x86 架构的,所以无法直接使用,需要从0 开始编译。以下是一个常用镜像的编译,做个备忘。参考资料:
docker build -t ss .
dockerfile文件如下:
FROM multiarch/alpine:armhf-v3.10
ARG SS_VER
ENV SS_URL https://github.com/shadowsocks/shadowsocks-libev/archive/v3.3.4.tar.gz
ENV SS_DIR shadowsocks-libev-3.3.4
RUN set -ex \
&& apk add --no-cache c-ares \
libcrypto1.1 \
libev \
libsodium \
mbedtls \
pcre \
&& apk add --no-cache \
--virtual TMP autoconf \
automake \
build-base \
c-ares-dev \
curl \
gettext-dev \
libev-dev \
libsodium-dev \
libtool \
linux-headers \
mbedtls-dev \
openssl-dev \
pcre-dev \
tar \
&& curl -sSL $SS_URL | tar xz \
&& cd $SS_DIR \
&& curl -sSL https://github.com/shadowsocks/ipset/archive/shadowsocks.tar.gz | tar xz --strip 1 -C libipset \
&& curl -sSL https://github.com/shadowsocks/libcork/archive/shadowsocks.tar.gz | tar xz --strip 1 -C libcork \
&& curl -sSL https://github.com/shadowsocks/libbloom/archive/master.tar.gz | tar xz --strip 1 -C libbloom \
&& ./autogen.sh \
&& ./configure --disable-documentation \
&& make install \
&& cd .. \
&& rm -rf $SS_DIR \
&& apk del TMP
ENTRYPOINT ["/usr/local/bin/ss-manager", "--manager-address", "/var/run/shadowsocks-manager.sock", "-c", "/etc/shadowsocks/config.json", "start"]
运行参考:
docker run -d --name=ss --net=host -v /root/config.json:/etc/shadowsocks/config.json:rw ss