-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.dev
More file actions
58 lines (41 loc) · 1.54 KB
/
Dockerfile.dev
File metadata and controls
58 lines (41 loc) · 1.54 KB
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
55
56
57
58
# Development Dockerfile - optimized for fast rebuilds
# Skips goose installation since migrations run locally
FROM golang:1.24-alpine AS builder
ARG VERSION=dev
WORKDIR /app
# Install minimal build dependencies
RUN apk add --no-cache git
# Copy go mod files for caching
COPY go.mod go.sum ./
# Download dependencies with cache mount
RUN --mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build \
go mod download
# Copy source code
COPY . .
# Build with cache mounts
RUN --mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build \
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build \
-ldflags="-w -s -X main.version=${VERSION}" \
-o brandishbot ./cmd/app
# Runtime stage
FROM alpine:3.19
ARG VERSION=dev
LABEL org.opencontainers.image.title="BrandishBot-Dev"
LABEL org.opencontainers.image.version="${VERSION}"
WORKDIR /app
# Minimal runtime dependencies (no postgresql-client needed for dev)
RUN apk add --no-cache ca-certificates tzdata && \
addgroup -g 1000 appuser && \
adduser -D -u 1000 -G appuser appuser && \
chown -R appuser:appuser /app
# Copy only the binary (no migrations, no goose)
COPY --from=builder --chown=appuser:appuser /app/brandishbot .
COPY --chown=appuser:appuser configs ./configs
USER appuser
EXPOSE 8080
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost:8080/healthz || exit 1
# Direct start - no entrypoint script needed for dev
CMD ["./brandishbot"]