33 lines
959 B
Docker
33 lines
959 B
Docker
|
FROM golang:alpine AS builder
|
||
|
|
||
|
LABEL stage=gobuilder
|
||
|
|
||
|
ENV CGO_ENABLED 0
|
||
|
ENV GOPROXY https://goproxy.cn,direct
|
||
|
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
|
||
|
|
||
|
WORKDIR /src
|
||
|
|
||
|
COPY ../.. .
|
||
|
RUN go mod download
|
||
|
RUN go build -ldflags="-s -w" -o /src/cmd/rpc/transfer cmd/rpc/transfer.go
|
||
|
RUN go build -ldflags="-s -w" -o /src/cmd/rpc/queue/queue cmd/rpc/queue/queue.go
|
||
|
|
||
|
FROM alpine:latest AS runtime
|
||
|
RUN apk update --no-cache && apk add --no-cache supervisor
|
||
|
RUN apk add --no-cache make
|
||
|
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
|
||
|
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
|
||
|
EXPOSE 10001
|
||
|
#CMD ["sh","/opt/startup.sh"]
|