-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathDockerfile
More file actions
42 lines (28 loc) · 879 Bytes
/
Dockerfile
File metadata and controls
42 lines (28 loc) · 879 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
FROM golang:1.21-alpine AS builder
WORKDIR /app
# Install git and build dependencies
RUN apk add --no-cache git
# Copy go mod and sum files
COPY go.mod go.sum ./
# Download dependencies
RUN go mod download
# Copy source code
COPY . .
# Build the application
RUN CGO_ENABLED=0 GOOS=linux go build -o immich-stack ./cmd/...
# Use a smaller image for the final container
FROM alpine:latest
# Apply image labels
LABEL org.opencontainers.image.source="https://github.com/Majorfi/immich-stack"
WORKDIR /app
# Install bash for the shell script
RUN apk add --no-cache bash
# Copy the binary from builder
COPY --from=builder /app/immich-stack .
# Create a non-root user and logs directory with correct ownership
RUN adduser -D -g '' appuser && \
mkdir -p /app/logs && \
chown appuser:appuser /app/logs
USER appuser
# Set the entrypoint
ENTRYPOINT ["./immich-stack"]