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

This commit is contained in:
AI Assistant
2026-03-12 14:20:56 +09:00
parent 0ad5d4ddbe
commit 4cdf1066e6
3 changed files with 9 additions and 7 deletions

View File

@@ -1,12 +1,12 @@
# 1. Build Go Backend # 1. Build Go Backend
FROM golang:1.21-alpine AS builder FROM golang:1.21-alpine AS builder
WORKDIR /app # Cache go modules
# 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/
# COPY backend/go.mod backend/go.sum ./backend/ RUN cd backend && go mod download
# RUN cd backend && go mod download
COPY backend/ ./backend/ COPY backend/ ./backend/
# We'll build the go binary inside the backend dir and put it in /app/main # 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 -o /app/main main.go RUN cd backend && CGO_ENABLED=1 go build -ldflags="-s -w" -o /app/main main.go
# 2. Final Minimal Image (Python + Go binary + Frontend) # 2. Final Minimal Image (Python + Go binary + Frontend)
FROM python:3.10-slim FROM python:3.10-slim

View File

@@ -39,6 +39,9 @@ func InitDB(dbPath string) {
log.Fatal("Failed to connect to database:", err) log.Fatal("Failed to connect to database:", err)
} }
// SQLite 동시성 최적화를 위해 WAL(Write-Ahead Logging) 모드를 활성화
DB.Exec("PRAGMA journal_mode=WAL;")
err = DB.AutoMigrate(&MediaHistory{}) err = DB.AutoMigrate(&MediaHistory{})
if err != nil { if err != nil {
log.Println("Database migration error:", err) log.Println("Database migration error:", err)

View File

@@ -1,2 +1 @@
yt-dlp yt-dlp
ffmpeg-python