Publish docker image with github actions (#1)
Co-authored-by: lowcarbdev <[email protected]>
This commit is contained in:
co-authored by
GitHub
lowcarbdev
parent
fd4e10634a
commit
7d53f20673
+14
-15
@@ -12,21 +12,22 @@ RUN npm ci
|
||||
# Copy frontend source
|
||||
COPY frontend/ ./
|
||||
|
||||
# Build frontend
|
||||
# Build frontend with production API URL (relative path)
|
||||
# This ensures the frontend uses relative paths instead of localhost:8081
|
||||
ENV VITE_API_URL=/api
|
||||
RUN npm run build
|
||||
|
||||
# Stage 2: Build backend
|
||||
FROM golang:bookworm AS backend-builder
|
||||
FROM golang:1.25-alpine AS backend-builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Install build dependencies for libheif and SQLite FTS5
|
||||
# Using bookworm-backports to get a newer version of libheif
|
||||
RUN echo "deb http://deb.debian.org/debian bookworm-backports main" >> /etc/apt/sources.list && \
|
||||
apt-get update && apt-get install -y \
|
||||
build-essential \
|
||||
&& apt-get install -y -t bookworm-backports libheif-dev \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
RUN apk add --no-cache \
|
||||
gcc \
|
||||
g++ \
|
||||
musl-dev \
|
||||
libheif-dev
|
||||
|
||||
# Copy go mod files
|
||||
COPY go.mod go.sum ./
|
||||
@@ -39,22 +40,20 @@ COPY *.go ./
|
||||
COPY internal/*.go internal/
|
||||
|
||||
# Build with FTS5 support
|
||||
RUN go build -tags "fts5 heic" -o sbv .
|
||||
# Use CGO for SQLite and libheif
|
||||
RUN CGO_ENABLED=1 go build -tags "fts5 heic" -o sbv .
|
||||
|
||||
# Stage 3: Final runtime image
|
||||
FROM debian:bookworm-slim
|
||||
FROM alpine:3
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Install runtime dependencies
|
||||
# Using bookworm-backports to get matching runtime library
|
||||
RUN echo "deb http://deb.debian.org/debian bookworm-backports main" >> /etc/apt/sources.list && \
|
||||
apt-get update && apt-get install -y \
|
||||
RUN apk add --no-cache \
|
||||
ca-certificates \
|
||||
wget \
|
||||
ffmpeg \
|
||||
&& apt-get install -y -t bookworm-backports libheif1 \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
libheif
|
||||
|
||||
# Copy backend binary
|
||||
COPY --from=backend-builder /app/sbv .
|
||||
|
||||
Reference in New Issue
Block a user