yq/Dockerfile
Yuri Volchkov 77b7270959 add build argument to use different uid/gid
While uid/gid 1000 will work in most setups, sometimes users have
different uid/gid. For example is a shared machine with multiple
users.

Signed-off-by: Yuri Volchkov <yuri@volch.org>
2022-08-03 19:08:36 +00:00

32 lines
740 B
Docker

FROM golang:1.18.4 as builder
WORKDIR /go/src/mikefarah/yq
COPY . .
RUN CGO_ENABLED=0 go build .
# RUN ./scripts/test.sh -- this too often times out in the github pipeline.
RUN ./scripts/acceptance.sh
# Choose alpine as a base image to make this useful for CI, as many
# CI tools expect an interactive shell inside the container
FROM alpine:3 as production
ARG USER_ID=1000
ARG GROUP_ID=1000
LABEL maintainer="Mike Farah <mikefarah@users.noreply.github.com>"
COPY --from=builder /go/src/mikefarah/yq/yq /usr/bin/yq
WORKDIR /workdir
RUN set -eux; \
addgroup -g $GROUP_ID yq; \
adduser -u $USER_ID -G yq -s /bin/sh -h /home/yq -D yq
RUN chown -R yq:yq /workdir
USER yq
ENTRYPOINT ["/usr/bin/yq"]