-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
50 lines (34 loc) · 1.04 KB
/
Dockerfile
File metadata and controls
50 lines (34 loc) · 1.04 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
FROM golang:1.25-bookworm AS builder
ARG versionflags
WORKDIR /app
RUN apt-get update && apt-get upgrade -y && rm -rf /var/lib/apt/lists/*
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 go build -v -a -tags netgo -ldflags="-extldflags '-static' -s -w $versionflags" -o osctl cmd/main.go
FROM debian:bookworm-slim
WORKDIR /app
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get upgrade -y && apt-get install -y --no-install-recommends \
ca-certificates \
curl \
wget \
dnsutils \
iputils-ping \
vim \
nano \
jq \
lsof \
net-tools \
procps \
tzdata \
traceroute \
mtr-tiny \
&& rm -rf /var/lib/apt/lists/*
COPY --from=builder /app/osctl /app/osctl
RUN chmod +x /app/osctl
ENV PATH="/app:${PATH}"
RUN mkdir -p /etc/bash_completion.d
RUN /app/osctl completion bash > /etc/bash_completion.d/osctl
RUN echo '[ -f /etc/bash_completion ] && . /etc/bash_completion' >> /etc/bash.bashrc
CMD ["/app/osctl"]