Skip to content

Commit

Permalink
fix: Dockerfile for permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
a5chin committed Dec 18, 2024
1 parent 408c3b0 commit 9ac6618
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,20 @@ ARG TRIVY_VERSION=0.57.1
FROM ghcr.io/aquasecurity/trivy:$TRIVY_VERSION AS trivy


FROM $BASE_IMAGE:$PYTHON_VERSION-$DEBIAN_VERSION
COPY --from=trivy --chown=vscode: /usr/local/bin/trivy /usr/local/bin/trivy

LABEL maintainer="a5chin <a5chin.origin+contact@gmain.com>"
FROM python:$PYTHON_VERSION-slim-$DEBIAN_VERSION AS builder

ARG GCLOUD_SDK_VERSION=502.0.0
ARG TFENV_VERSION=v3.0.0

SHELL [ "/bin/bash", "-o", "pipefail", "-c" ]

# hadolint ignore=DL3008
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
curl git \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

RUN if [ "$(uname -m)" = 'aarch64' ]; then _ARCH=arm; else _ARCH=x86_64; fi \
&& curl -fsS "https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-cli-$GCLOUD_SDK_VERSION-linux-$_ARCH.tar.gz" \
| tar zx -C /opt \
Expand All @@ -27,5 +31,14 @@ RUN if [ "$(uname -m)" = 'aarch64' ]; then _ARCH=arm; else _ARCH=x86_64; fi \

RUN git clone --depth=1 -b $TFENV_VERSION https://github.com/tfutils/tfenv.git /opt/tfenv


FROM $BASE_IMAGE:$PYTHON_VERSION-$DEBIAN_VERSION

COPY --from=trivy --chown=vscode: /usr/local/bin/trivy /usr/local/bin/trivy
COPY --from=builder --chown=vscode: /opt/google-cloud-sdk /opt/google-cloud-sdk
COPY --from=builder --chown=vscode: /opt/tfenv /opt/tfenv

LABEL maintainer="a5chin <a5chin.origin+contact@gmain.com>"

ENV PATH=$PATH:/opt/google-cloud-sdk/bin
ENV PATH=$PATH:/opt/tfenv/bin

0 comments on commit 9ac6618

Please sign in to comment.