You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
860 B
32 lines
860 B
2 years ago
|
# 打包依赖阶段使用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
|
||
|
|