mirror of
https://github.com/lukaszraczylo/gohoarder.git
synced 2026-06-05 22:53:53 +00:00
c1103630f0
Changes: - Set CGO_ENABLED=1 for migrate build in .goreleaser.yaml - Add sqlite-libs and musl runtime dependencies to Dockerfile.migrate This fixes the migration error: 'Binary was compiled with CGO_ENABLED=0, go-sqlite3 requires cgo to work'
33 lines
718 B
Docker
33 lines
718 B
Docker
# Migration Engine - Database Migration Tool
|
|
ARG TARGETOS
|
|
ARG TARGETARCH
|
|
|
|
FROM alpine:latest
|
|
|
|
# Install runtime dependencies (including CGO/SQLite dependencies)
|
|
RUN apk add --no-cache \
|
|
ca-certificates \
|
|
postgresql-client \
|
|
mysql-client \
|
|
busybox-extras \
|
|
sqlite-libs \
|
|
musl \
|
|
&& update-ca-certificates
|
|
|
|
# Create non-root user
|
|
RUN addgroup -g 1000 gohoarder && \
|
|
adduser -D -u 1000 -G gohoarder gohoarder
|
|
|
|
# Copy binary (from platform-specific path)
|
|
ARG TARGETOS
|
|
ARG TARGETARCH
|
|
COPY ${TARGETOS}/${TARGETARCH}/migrate /usr/local/bin/migrate
|
|
RUN chmod +x /usr/local/bin/migrate
|
|
|
|
WORKDIR /app
|
|
USER gohoarder
|
|
|
|
# Run migrations
|
|
ENTRYPOINT ["/usr/local/bin/migrate"]
|
|
CMD ["--action=migrate"]
|