transfer_rs/Dockerfile

32 lines
888 B
Docker
Raw Normal View History

2024-06-18 18:14:57 +08:00
FROM golang:1.21.10-alpine AS builder
LABEL stage=gobuilder
2024-06-18 18:23:48 +08:00
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories/
2024-06-18 18:14:57 +08:00
ENV CGO_ENABLED 0
ENV GOPROXY https://goproxy.cn,direct
WORKDIR /src
COPY ../.. .
RUN go mod download
RUN go build -ldflags="-s -w" -o /src/cmd/api/transfer cmd/api/transfer.go
FROM alpine:latest AS runtime
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories/
RUN apk update --no-cache && apk add --no-cache supervisor
RUN apk add --no-cache make
ENV TZ Asia/Shanghai
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=builder /src /src
RUN mkdir "/var/log/supervisor"
WORKDIR /src
ADD ./sh/startup.sh /opt/startup.sh
RUN sed -i 's/\r//g' /opt/startup.sh
ADD ./sh/supervisord.conf /etc/supervisord.conf
WORKDIR /src
2024-06-18 18:23:48 +08:00
EXPOSE 10101
2024-06-18 18:14:57 +08:00
#CMD ["sh","/opt/startup.sh"]