forked from xorpaul/g10k
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.trixie-build-static
46 lines (35 loc) · 1.06 KB
/
Dockerfile.trixie-build-static
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
## Build and run like:
# podman build -t g10k:test -f Dockerfile.trixie .
# podman run --rm g10k:test
# podman run --rm -it --entrypoint /bin/sh g10k:test
# podman ps
# podman cp <container id>:/usr/local/bin/g10k ./g10k
FROM debian:trixie-slim as builder
RUN set -ex \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates \
build-essential \
git \
golang \
&& apt-get clean \
&& rm -rf /tmp/* /var/tmp/*
# copy local project files:
COPY . /usr/src/g10k
WORKDIR /usr/src/g10k
RUN make clean
RUN go clean -cache \
&& go clean -testcache
RUN go get -u
RUN go mod vendor
RUN go clean -cache \
&& go clean -testcache \
&& export CGO_ENABLED=0 \
&& BUILDTIME=$(date -u '+%Y-%m-%d_%H:%M:%S') \
&& BUILDVERSION=$(git describe --tags) \
&& go build -ldflags "-X main.buildtime=${BUILDTIME} -X main.buildversion=${BUILDVERSION}"
ENTRYPOINT [ "/bin/bash" ]
FROM debian:trixie-slim
COPY --from=builder /usr/src/g10k/g10k /usr/local/bin/g10k
ENTRYPOINT [ "/usr/local/bin/g10k" ]
CMD ["-version"]