42 lines
1.6 KiB
YAML
42 lines
1.6 KiB
YAML
services:
|
|
video-factory:
|
|
build:
|
|
dockerfile_inline: |
|
|
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"]
|
|
container_name: video-factory
|
|
ports:
|
|
- "3006:3006"
|
|
volumes:
|
|
- /data/video-factory/workspace:/app/workspace
|
|
- /data/video-factory/short_drama.db:/app/short_drama.db
|
|
restart: unless-stopped
|
|
|
|
networks:
|
|
default:
|
|
name: video-factory-network
|