Skip to content

Commit 10b96b9

Browse files
committed
feat: add caching to dockerfile; remove no longer required nsswitch.conf overrides
Signed-off-by: Liam Stanley <[email protected]>
1 parent 4a7b643 commit 10b96b9

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

Dockerfile

+13-6
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,29 @@
1+
# syntax = docker/dockerfile:1.4
2+
13
# build image
24
FROM golang:alpine as build
35
WORKDIR /build
6+
47
RUN apk add --no-cache make
58
COPY go.sum go.mod Makefile /build/
6-
RUN make go-fetch
9+
RUN \
10+
--mount=type=cache,target=/root/.cache \
11+
--mount=type=cache,target=/go \
12+
make go-fetch
13+
714
COPY . /build/
8-
RUN make
15+
RUN \
16+
--mount=type=cache,target=/root/.cache \
17+
--mount=type=cache,target=/go \
18+
make
919

1020
# runtime image
1121
FROM alpine:3.18
1222
RUN apk add --no-cache ca-certificates
13-
# set up nsswitch.conf for Go's "netgo" implementation
14-
# - https://github.com/docker-library/golang/blob/1eb096131592bcbc90aa3b97471811c798a93573/1.14/alpine3.12/Dockerfile#L9
15-
RUN if [ ! -e /etc/nsswitch.conf ];then echo 'hosts: files dns' > /etc/nsswitch.conf;fi
1623
COPY --from=build /build/vault-unseal /usr/local/bin/vault-unseal
1724

1825
# runtime params
1926
WORKDIR /
2027
ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
2128
ENV LOG_JSON=true
22-
CMD ["vault-unseal"]
29+
CMD ["/usr/local/bin/vault-unseal"]

0 commit comments

Comments
 (0)