TempMailReceiver/Dockerfile
2023-10-30 13:52:35 +00:00

23 lines
667 B
Docker
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 使用Alpine Linux作为基础镜像
FROM golang:1.20-alpine
# 设置工作目录
WORKDIR /app
# 安装git克隆代码仓库编译应用然后卸载git
RUN echo 'nameserver 1.1.1.1' > /etc/resolv.conf && \
apk add --no-cache git && \
git clone https://gitlab.ni-co.moe/shira/temp-mail-receiver.git /tmp/code && \
cd /tmp/code && \
go build -o /app/myapp && \
cp generate-config.sh /app/generate-config.sh && \
cd /app && \
rm -rf /tmp/code && \
apk del git
# 赋予脚本执行权限
RUN chmod +x /app/generate-config.sh
# 设置启动命令
ENTRYPOINT ["/app/generate-config.sh"]
CMD ["/app/myapp", "-c", "config.json"]