1
This commit is contained in:
+26
@@ -0,0 +1,26 @@
|
||||
FROM golang:alpine AS builder
|
||||
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories \
|
||||
&& apk add --no-cache git ca-certificates tzdata
|
||||
ENV TZ=Asia/Shanghai
|
||||
ENV GO111MODULE=on
|
||||
ENV GOPROXY=https://goproxy.cn,direct
|
||||
ENV CGO_ENABLED=0
|
||||
ENV GOTOOLCHAIN=auto
|
||||
WORKDIR /build
|
||||
COPY . .
|
||||
RUN go mod download && go mod tidy
|
||||
RUN go build -ldflags="-s -w" -o main ./main.go
|
||||
|
||||
FROM alpine:3.19
|
||||
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories \
|
||||
&& apk add --no-cache ca-certificates tzdata ffmpeg
|
||||
ENV TZ=Asia/Shanghai
|
||||
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
||||
WORKDIR /app
|
||||
COPY --from=builder /build/config.yml .
|
||||
COPY --from=builder /build/prompt.md .
|
||||
COPY --from=builder /build/default_first_frame.png .
|
||||
COPY --from=builder /build/main .
|
||||
RUN printf '#!/bin/sh\nif [ -d /app/short_drama.db ]; then rm -rf /app/short_drama.db; fi\ntouch /app/short_drama.db 2>/dev/null || true\nexec ./main\n' > /app/entrypoint.sh && chmod +x /app/entrypoint.sh
|
||||
EXPOSE 3006
|
||||
ENTRYPOINT ["/app/entrypoint.sh"]
|
||||
@@ -1,23 +0,0 @@
|
||||
services:
|
||||
golang-base:
|
||||
build:
|
||||
dockerfile_inline: |
|
||||
FROM golang:alpine
|
||||
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories \
|
||||
&& apk add --no-cache git ca-certificates tzdata
|
||||
ENV TZ=Asia/Shanghai
|
||||
ENV GO111MODULE=on
|
||||
ENV GOPROXY=https://goproxy.cn,direct
|
||||
ENV CGO_ENABLED=0
|
||||
ENV GOTOOLCHAIN=auto
|
||||
image: golang-base:latest
|
||||
|
||||
ffmpeg-base:
|
||||
build:
|
||||
dockerfile_inline: |
|
||||
FROM alpine:3.19
|
||||
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories \
|
||||
&& apk add --no-cache ca-certificates tzdata ffmpeg
|
||||
ENV TZ=Asia/Shanghai
|
||||
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
||||
image: alpine-base:latest
|
||||
+1
-16
@@ -1,22 +1,7 @@
|
||||
services:
|
||||
video-factory:
|
||||
build:
|
||||
dockerfile_inline: |
|
||||
FROM golang-base:latest AS builder
|
||||
WORKDIR /build
|
||||
COPY . .
|
||||
RUN go mod download && go mod tidy
|
||||
RUN go build -ldflags="-s -w" -o main ./main.go
|
||||
|
||||
FROM alpine-base:latest
|
||||
WORKDIR /app
|
||||
COPY --from=builder /build/config.yml .
|
||||
COPY --from=builder /build/prompt.md .
|
||||
COPY --from=builder /build/default_first_frame.png .
|
||||
COPY --from=builder /build/main .
|
||||
RUN printf '#!/bin/sh\nif [ -d /app/short_drama.db ]; then rm -rf /app/short_drama.db; fi\ntouch /app/short_drama.db 2>/dev/null || true\nexec ./main\n' > /app/entrypoint.sh && chmod +x /app/entrypoint.sh
|
||||
EXPOSE 3006
|
||||
ENTRYPOINT ["/app/entrypoint.sh"]
|
||||
dockerfile: Dockerfile
|
||||
container_name: video-factory
|
||||
ports:
|
||||
- "3006:3006"
|
||||
|
||||
Reference in New Issue
Block a user