Optimize Dockerfile cache, binary size, SQLite WAL, and remove unused python package
Some checks failed
Build and Push Docker Image / build-and-push (push) Failing after 33s
Some checks failed
Build and Push Docker Image / build-and-push (push) Failing after 33s
This commit is contained in:
12
Dockerfile
12
Dockerfile
@@ -1,12 +1,12 @@
|
||||
# 1. Build Go Backend
|
||||
FROM golang:1.21-alpine AS builder
|
||||
WORKDIR /app
|
||||
# TODO: go mod init & go mod download will be added later when we create the go backend code
|
||||
# COPY backend/go.mod backend/go.sum ./backend/
|
||||
# RUN cd backend && go mod download
|
||||
# Cache go modules
|
||||
COPY backend/go.mod backend/go.sum ./backend/
|
||||
RUN cd backend && go mod download
|
||||
|
||||
COPY backend/ ./backend/
|
||||
# We'll build the go binary inside the backend dir and put it in /app/main
|
||||
RUN cd backend && CGO_ENABLED=1 go build -o /app/main main.go
|
||||
# We'll build the go binary inside the backend dir and put it in /app/main. Remove debug info for smaller binary.
|
||||
RUN cd backend && CGO_ENABLED=1 go build -ldflags="-s -w" -o /app/main main.go
|
||||
|
||||
# 2. Final Minimal Image (Python + Go binary + Frontend)
|
||||
FROM python:3.10-slim
|
||||
|
||||
@@ -39,6 +39,9 @@ func InitDB(dbPath string) {
|
||||
log.Fatal("Failed to connect to database:", err)
|
||||
}
|
||||
|
||||
// SQLite 동시성 최적화를 위해 WAL(Write-Ahead Logging) 모드를 활성화
|
||||
DB.Exec("PRAGMA journal_mode=WAL;")
|
||||
|
||||
err = DB.AutoMigrate(&MediaHistory{})
|
||||
if err != nil {
|
||||
log.Println("Database migration error:", err)
|
||||
|
||||
@@ -1,2 +1 @@
|
||||
yt-dlp
|
||||
ffmpeg-python
|
||||
|
||||
Reference in New Issue
Block a user