Skip to content
This repository has been archived by the owner on Feb 17, 2024. It is now read-only.

improvement - run tflint binary as non-privileged user in container #69

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,20 @@ FROM alpine:3.17.0

LABEL maintainer=terraform-linters

RUN apk add --no-cache ca-certificates
ARG USER=tflint
ARG USER_ID=10001
ARG GROUP=tflint
ARG GROUP_ID=10001

RUN addgroup -g ${GROUP_ID} ${GROUP} && \
adduser -h /home/${USER} -u ${USER_ID} -G ${GROUP} -D ${USER}

RUN apk add --no-cache ca-certificates && update-ca-certificates

COPY --from=builder /usr/local/bin/tflint /usr/local/bin
COPY --from=builder /root/.tflint.d /root/.tflint.d
COPY --from=builder --chown=${USER}:${GROUP} /root/.tflint.d /home/${USER}/.tflint.d

ENTRYPOINT ["tflint"]
USER ${USER}
WORKDIR /data

ENTRYPOINT ["tflint"]