-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from a5chin/feature/devcontainer
DevContainer のアップデート
- Loading branch information
Showing
6 changed files
with
105 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,31 @@ | ||
FROM debian:bookworm-slim AS builder | ||
ARG BASE_IMAGE=mcr.microsoft.com/vscode/devcontainers/python | ||
ARG DEBIAN_VERSION=bookworm | ||
ARG PYTHON_VERSION=3.12 | ||
ARG TRIVY_VERSION=0.57.1 | ||
|
||
# hadolint ignore=DL3008 | ||
RUN apt-get update && \ | ||
apt-get install -y --no-install-recommends \ | ||
apt-transport-https \ | ||
ca-certificates \ | ||
curl \ | ||
gnupg \ | ||
lsb-release | ||
|
||
SHELL [ "/bin/bash", "-o", "pipefail", "-c" ] | ||
FROM ghcr.io/aquasecurity/trivy:$TRIVY_VERSION AS trivy | ||
|
||
# Install gcloud | ||
# ref: https://cloud.google.com/sdk/docs/install#deb | ||
RUN curl https://packages.cloud.google.com/apt/doc/apt-key.gpg \ | ||
| gpg --dearmor -o /usr/share/keyrings/cloud.google.gpg && \ | ||
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" \ | ||
| tee -a /etc/apt/sources.list.d/google-cloud-sdk.list | ||
|
||
# Install Trivy | ||
# ref: https://trivy.dev/dev/getting-started/installation/ | ||
RUN curl https://aquasecurity.github.io/trivy-repo/deb/public.key | apt-key add - && \ | ||
echo "deb https://aquasecurity.github.io/trivy-repo/deb $(lsb_release -sc) main" \ | ||
| tee -a /etc/apt/sources.list.d/trivy.list | ||
FROM $BASE_IMAGE:$PYTHON_VERSION-$DEBIAN_VERSION | ||
COPY --from=trivy --chown=vscode: /usr/local/bin/trivy /usr/local/bin/trivy | ||
|
||
# hadolint ignore=DL3008 | ||
RUN apt-get update && \ | ||
apt-get install -y --no-install-recommends \ | ||
google-cloud-cli \ | ||
trivy | ||
LABEL maintainer="a5chin <a5chin.origin+contact@gmain.com>" | ||
|
||
ARG GCLOUD_SDK_VERSION=502.0.0 | ||
ARG TFENV_VERSION=v3.0.0 | ||
|
||
FROM mcr.microsoft.com/vscode/devcontainers/base:bookworm | ||
SHELL [ "/bin/bash", "-o", "pipefail", "-c" ] | ||
|
||
LABEL maintainer="a5chin <a5chin.origin+contact@gmain.com>" | ||
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 \ | ||
&& /opt/google-cloud-sdk/install.sh \ | ||
--quiet \ | ||
--usage-reporting=false \ | ||
--additional-components alpha beta | ||
|
||
RUN git clone --depth=1 -b $TFENV_VERSION https://github.com/tfutils/tfenv.git /opt/tfenv | ||
|
||
COPY --from=builder --chown=vscode: /usr/bin/python* /usr/bin/python* | ||
COPY --from=builder --chown=vscode: /usr/bin/gcloud /usr/bin/gcloud | ||
COPY --from=builder --chown=vscode: /usr/bin/trivy /usr/bin/trivy | ||
COPY --from=builder --chown=vscode: /usr/lib /usr/lib | ||
ENV PATH=$PATH:/opt/google-cloud-sdk/bin | ||
ENV PATH=$PATH:/opt/tfenv/bin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: Docker | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
|
||
jobs: | ||
lint-devcontainer: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Lint Dockerfile | ||
uses: hadolint/hadolint-action@v3.1.0 | ||
with: | ||
dockerfile: .devcontainer/Dockerfile | ||
|
||
build-devcontainer: | ||
runs-on: ubuntu-latest | ||
|
||
needs: lint-devcontainer | ||
if: ${{ success() }} | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Build and push | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: . | ||
file: .devcontainer/Dockerfile | ||
push: false | ||
tags: latest | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters