fajiao
2 years ago
1 changed files with 31 additions and 0 deletions
@ -0,0 +1,31 @@ |
|||
# 打包依赖阶段使用golang作为基础镜像 |
|||
FROM golang:1.18 as builder |
|||
|
|||
# 启用 go module,切换代理 |
|||
ENV GO111MODULE=on GOPROXY=https://goproxy.cn,direct |
|||
|
|||
WORKDIR /app |
|||
COPY . . |
|||
|
|||
# CGO_ENABLED禁用cgo 然后指定OS等,并go build |
|||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o ycmediakit main.go |
|||
|
|||
RUN mkdir build && cp ycmediakit build && cp -r config build |
|||
|
|||
# 运行阶段指定scratch作为基础镜像 |
|||
FROM jrottenberg/ffmpeg:4.1-alpine |
|||
|
|||
WORKDIR /app |
|||
# 将上一个阶段publish文件夹下的所有文件复制进来 |
|||
COPY --from=builder /app/build . |
|||
|
|||
#设置时区,解决时区问题 |
|||
RUN echo "Asia/Shanghai" > /etc/timezone; |
|||
|
|||
EXPOSE 8888 |
|||
ENTRYPOINT ["./ycmediakit"] |
|||
|
|||
# docker build -t ycmediakit . |
|||
# docker run -p 8888:8888 ycmediakit |
|||
# docker run -itd -p 8888:8888 --restart always --name ycmediakit ycmediakit:latest /bin/bash |
|||
|
Loading…
Reference in new issue