-
-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathDockerfile
45 lines (29 loc) · 1.38 KB
/
Dockerfile
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
FROM ghcr.io/jauderho/golang:1.23.5-alpine3.21@sha256:9d07aef84b1aabde0c5dddd3f6153a09551db52b840749400639398959368561 AS build
WORKDIR /go/src/github.com/wader/fq
ARG BUILD_VERSION
ARG ARCHIVE_URL=https://github.com/wader/fq/archive/
ENV GO111MODULE on
ENV CGO_ENABLED 0
COPY . .
RUN test -n "${BUILD_VERSION}" \
&& apk update \
&& apk upgrade -a \
&& apk add --no-cache ca-certificates curl git gcc build-base \
&& update-ca-certificates \
&& curl -L "${ARCHIVE_URL}${BUILD_VERSION}.tar.gz" -o /tmp/fq.tar.gz \
&& tar xzf /tmp/fq.tar.gz --strip 1 -C /go/src/github.com/wader/fq \
&& go get -u golang.org/x/crypto golang.org/x/net \
&& go build -o fq -v -trimpath -ldflags="-s -w -X main.version=${BUILD_VERSION}" .
# Validation check
RUN cp fq /go/bin/fq
# ----------------------------------------------------------------------------
FROM scratch
#FROM alpine:3.15.0
LABEL org.opencontainers.image.authors="Jauder Ho <[email protected]>"
LABEL org.opencontainers.image.url="https://github.com/jauderho/dockerfiles"
LABEL org.opencontainers.image.documentation="https://github.com/jauderho/dockerfiles"
LABEL org.opencontainers.image.source="https://github.com/jauderho/dockerfiles"
LABEL org.opencontainers.image.title="jauderho/fq"
LABEL org.opencontainers.image.description="fq is a tool for inspecting binary data"
COPY --from=build /go/bin/fq /fq
ENTRYPOINT ["/fq"]