This repository has been archived on 2026-07-15. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
drive/backend/Dockerfile
Elijah 5200654d0f
All checks were successful
Automated Container Build / build-and-push (push) Successful in 1m19s
New context menu, info pane fixes, pinned item syncing, and navigation bug fixes
2026-05-22 19:40:08 -07:00

45 lines
904 B
Docker

# Build stage
FROM golang:1.23-alpine AS builder
RUN apk add --no-cache gcc musl-dev sqlite-dev git
WORKDIR /build
COPY go.mod ./
# Copy everything and generate go.sum inside the container
COPY . .
RUN go mod tidy
RUN go mod download
RUN CGO_ENABLED=1 GOOS=linux go build -tags sqlite_fts5 -ldflags="-s -w" -o /build/drive ./main.go
# Runtime stage
FROM alpine:3.21
RUN apk add --no-cache \
ffmpeg \
sqlite \
ca-certificates \
mailcap \
tzdata
# Create non-root user
RUN addgroup -S drive && adduser -S drive -G drive
WORKDIR /app
COPY --from=builder /build/drive /app/drive
# Create default directories
RUN mkdir -p /app/data /storage && \
chown -R drive:drive /app /app/data /storage
USER drive
EXPOSE 5827
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD wget -qO- http://127.0.0.1:5827/health || exit 1
ENTRYPOINT ["/app/drive"]