Dockerfile似乎在32位系统上无法构建
Closed this issue · 1 comments
daiaji commented
FROM ubuntu:latest as builder
RUN apt-get update \
&& apt-get install curl -y \
&& curl -fsSL https://install.direct/go.sh | bash
FROM scratch
LABEL maintainer "Darian Raymond <admin@v2ray.com>"
COPY --from=builder /usr/bin/v2ray/v2ray /usr/bin/v2ray/v2ctl /usr/bin/v2ray/geoip.dat /usr/bin/v2ray/geosite.dat /usr/bin/v2ray/
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY config.json /etc/v2ray/config.json
ENV PATH /usr/bin/v2ray:$PATH
CMD ["v2ray", "-config=/etc/v2ray/config.json"]
这样就OK
非用alpine当底包不可的话
就直接
FROM alpine
FROM alpine:latest
似乎直接初始化不过
不知为何
似乎只是单纯的镜像有问题
重构建一边就成?
YanzheL commented
可以尝试这个优化后的Dockerfile
FROM alpine:3.11 AS downloader
RUN apk add -U --no-cache curl
WORKDIR /etc/v2ray
# Configurable arguments defined at build time. User can override them by docker build --build-arg ARG_NAME=ARG_VALUE
# Default OS type = linux
ARG OS=linux
# Default architecture = 64
ARG ARCH=64
# Download and unpack latest release from official github release
RUN V2RAY_FILE=v2ray-${OS}-${ARCH}.zip \
VERSION=$(curl -s https://github.com/v2ray/v2ray-core/releases/latest |grep -oE '\d\.\d+\.\d+') \
&& echo "Got latest version = ${VERSION}, file = ${V2RAY_FILE}" \
&& curl -Lo $V2RAY_FILE https://github.com/v2ray/v2ray-core/releases/download/v${VERSION}/$V2RAY_FILE \
&& unzip $V2RAY_FILE \
&& rm $V2RAY_FILE
# Use distroless as minimal base image to package the executable binary
# Refer to https://github.com/GoogleContainerTools/distroless for more details
# Note: Use gcr.azk8s.cn as repo-mirror if gcr.io is blocked by China GFW.
FROM gcr.io/distroless/static:latest
WORKDIR /etc/v2ray
COPY --from=downloader /etc/v2ray .
COPY config.json /etc/v2ray/config.json
ENTRYPOINT ["/etc/v2ray/v2ray"]
CMD ["-config=/etc/v2ray/config.json"]
构建方式
docker build --build-arg OS=linux --build-arg ARCH=32 -t test .