bin / Dockerfile
hrbust's picture
Create Dockerfile
1f7db22 verified
Raw History Blame Contribute Delete
781 Bytes
FROM alpine:3.14
# 设置工作目录
WORKDIR /app
# 安装必要的软件包
RUN apk add --no-cache curl netcat-openbsd
# 设置环境变量
ENV BIN_VERSION=2.4.0
ENV BIN_PORT=6163
ENV BIN_URL=https://github.com/wantguns/bin/releases/download/v${BIN_VERSION}/bin-v${BIN_VERSION}-x86_64-unknown-linux-gnu
# 下载并设置可执行权限
RUN curl -L ${BIN_URL} -o bin && \
chmod +x bin
# 创建上传目录并设置适当的权限
RUN mkdir -p /upload && \
chmod 777 /upload
# 暴露端口
EXPOSE 6163
# 健康检查
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
CMD nc -z 0.0.0.0 6163 || exit 1
# 使用 root 用户运行应用
USER root
# 运行二进制文件,并指定上传目录
CMD ["./bin", "-a", "0.0.0.0", "-u", "/upload"]