-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
54 lines (37 loc) · 976 Bytes
/
Dockerfile
File metadata and controls
54 lines (37 loc) · 976 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
43
44
45
46
47
48
49
50
51
52
53
54
# Production Dockerfile
FROM golang:1.24-alpine AS builder
# Install build dependencies
RUN apk add --no-cache git make
# Set working directory
WORKDIR /app
# Copy go mod files
COPY go.mod go.sum ./
# Download dependencies
RUN go mod download
# Copy the entire project
COPY . .
# Build the binaries
RUN make build
# Final stage - minimal runtime image
FROM alpine:latest
# Install runtime dependencies
RUN apk add --no-cache ca-certificates
# Create non-root user
RUN adduser -D -g '' pcas
# Set working directory
WORKDIR /app
# Copy binaries from builder
COPY --from=builder /app/bin/pcas /app/bin/pcas
COPY --from=builder /app/bin/pcasctl /app/bin/pcasctl
# Copy configuration files
COPY policy.yaml .
# Change ownership
RUN chown -R pcas:pcas /app
# Create and set permissions for the data directory
RUN mkdir /data && chown pcas:pcas /data
# Switch to non-root user
USER pcas
# Expose gRPC port
EXPOSE 50051
# Run the server
CMD ["/app/bin/pcas", "serve"]