-
Notifications
You must be signed in to change notification settings - Fork 71
Expand file tree
/
Copy pathDockerfile
More file actions
63 lines (49 loc) · 1.7 KB
/
Copy pathDockerfile
File metadata and controls
63 lines (49 loc) · 1.7 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
59
60
61
62
63
# syntax=docker/dockerfile:1.24.0@sha256:87999aa3d42bdc6bea60565083ee17e86d1f3339802f543c0d03998580f9cb89
# Build stage
FROM golang:1.26.5-alpine3.24@sha256:0178a641fbb4858c5f1b48e34bdaabe0350a330a1b1149aabd498d0699ff5fb2 AS builder
WORKDIR /app
# Install build dependencies
RUN apk add --no-cache \
git=2.54.0-r0 \
ca-certificates=20260611-r0 \
tzdata=2026b-r0
# Copy module metadata first for better caching.
# This repo uses a local replace for Bubble Tea, so its module files must be
# present before `go mod download`.
COPY go.mod go.sum ./
COPY third_party/bubbletea/go.mod third_party/bubbletea/go.sum ./third_party/bubbletea/
RUN go mod download
# Copy source
COPY . .
# Build with optimizations
ARG VERSION=dev
ARG COMMIT=unknown
ARG DATE=unknown
RUN CGO_ENABLED=0 GOOS=linux go build \
-trimpath \
-ldflags="-s -w \
-X github.com/Dicklesworthstone/ntm/internal/cli.Version=${VERSION} \
-X github.com/Dicklesworthstone/ntm/internal/cli.Commit=${COMMIT} \
-X github.com/Dicklesworthstone/ntm/internal/cli.Date=${DATE} \
-X github.com/Dicklesworthstone/ntm/internal/cli.BuiltBy=docker" \
-o /ntm ./cmd/ntm
# Runtime stage
FROM alpine:3.24.1@sha256:28bd5fe8b56d1bd048e5babf5b10710ebe0bae67db86916198a6eec434943f8b
# Install runtime dependencies
RUN apk add --no-cache \
tmux=3.6b-r0 \
ca-certificates=20260611-r0 \
tzdata=2026b-r0 \
bash=5.3.9-r1 \
zsh=5.9-r7
# Create non-root user
RUN adduser -D -g '' ntm
USER ntm
WORKDIR /home/ntm
# Copy binary
COPY --from=builder /ntm /usr/local/bin/ntm
# Default shell init
RUN echo 'eval "$(ntm shell bash)"' >> ~/.bashrc && \
echo 'eval "$(ntm shell zsh)"' >> ~/.zshrc
ENTRYPOINT ["ntm"]
CMD ["--help"]