2024-06-15 06:00:02 +00:00
|
|
|
FROM golang:1.22.4 as builder
|
2018-04-01 09:48:06 +00:00
|
|
|
|
|
|
|
WORKDIR /go/src/mikefarah/yq
|
|
|
|
|
2021-11-20 16:21:17 +00:00
|
|
|
COPY . .
|
2018-04-01 09:48:06 +00:00
|
|
|
|
2023-03-16 02:36:51 +00:00
|
|
|
RUN CGO_ENABLED=0 go build -ldflags "-s -w" .
|
2021-10-30 03:08:13 +00:00
|
|
|
# RUN ./scripts/test.sh -- this too often times out in the github pipeline.
|
2021-09-20 01:57:05 +00:00
|
|
|
RUN ./scripts/acceptance.sh
|
2018-04-01 09:48:06 +00:00
|
|
|
|
|
|
|
# Choose alpine as a base image to make this useful for CI, as many
|
|
|
|
# CI tools expect an interactive shell inside the container
|
2021-10-19 23:58:54 +00:00
|
|
|
FROM alpine:3 as production
|
2021-11-20 16:21:17 +00:00
|
|
|
LABEL maintainer="Mike Farah <mikefarah@users.noreply.github.com>"
|
2021-06-16 03:40:39 +00:00
|
|
|
|
2018-04-01 09:48:06 +00:00
|
|
|
COPY --from=builder /go/src/mikefarah/yq/yq /usr/bin/yq
|
|
|
|
|
2021-11-20 16:21:17 +00:00
|
|
|
WORKDIR /workdir
|
2018-10-25 06:49:46 +00:00
|
|
|
|
2021-11-20 16:21:17 +00:00
|
|
|
RUN set -eux; \
|
|
|
|
addgroup -g 1000 yq; \
|
|
|
|
adduser -u 1000 -G yq -s /bin/sh -h /home/yq -D yq
|
2021-12-02 09:06:14 +00:00
|
|
|
|
|
|
|
RUN chown -R yq:yq /workdir
|
|
|
|
|
2021-06-16 03:40:39 +00:00
|
|
|
USER yq
|
|
|
|
|
2020-11-20 02:53:44 +00:00
|
|
|
ENTRYPOINT ["/usr/bin/yq"]
|