From e6e24d1e42e8e940415ccd142ea79ab46a9fb3ba Mon Sep 17 00:00:00 2001 From: Kat Morgan Date: Wed, 15 Nov 2023 16:18:02 -0800 Subject: [PATCH] disable user optional packages and install hugo (#22) * disable optional extras and add hugo * disable optional extras and add hugo --- Dockerfile | 85 +++++++++++++++++++++---------------- devcontainer.json | 25 ++++++++--- team-docs/devcontainer.json | 61 -------------------------- 3 files changed, 67 insertions(+), 104 deletions(-) delete mode 100644 team-docs/devcontainer.json diff --git a/Dockerfile b/Dockerfile index 66a5e86..4a5185b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -221,50 +221,63 @@ RUN set -ex \ && yarn --version \ && true -# Install kind (kubernetes-in-docker) -# TODO: relocate install to devcontainer.json -RUN set -ex \ - && export arch=$(uname -m | awk '{ if ($1 == "x86_64") print "amd64"; else if ($1 == "aarch64" || $1 == "arm64") print "arm64"; else print "unknown" }') \ - && export urlKindRelease="https://api.github.com/repos/kubernetes-sigs/kind/releases/latest" \ - && export urlKindVersion=$(curl -s ${urlKindRelease} | awk -F '["v,]' '/tag_name/{print $5}') \ - && export urlKindBase="https://github.com/kubernetes-sigs/kind/releases/download" \ - && export urlKindBin="kind-linux-${arch}" \ - && export urlKind="${urlKindBase}/v${urlKindVersion}/${urlKindBin}" \ - && sudo curl -L ${urlKind} --output /usr/local/bin/kind \ - && sudo chmod +x /usr/local/bin/kind \ - && which kind \ - && kind version \ - && true - -# Install kubectl -# TODO: relocate install to devcontainer.json +# Install hugo +EXPOSE 1313 RUN set -ex \ && export arch=$(uname -m | awk '{ if ($1 == "x86_64") print "amd64"; else if ($1 == "aarch64" || $1 == "arm64") print "arm64"; else print "unknown" }') \ - && export varKubectlVersion="$(curl --silent -L https://storage.googleapis.com/kubernetes-release/release/stable.txt | sed 's/v//g')" \ - && export varKubectlUrl="https://storage.googleapis.com/kubernetes-release/release/v${varKubectlVersion}/bin/linux/${arch}/kubectl" \ - && sudo curl -L ${varKubectlUrl} --output /usr/local/bin/kubectl \ - && sudo chmod +x /usr/local/bin/kubectl \ - && kubectl version --client || true \ + && export urlHugoRelease="https://api.github.com/repos/gohugoio/hugo/releases/latest" \ + && export urlHugoVersion=$(curl -s ${urlHugoRelease} | awk -F '["v,]' '/tag_name/{print $5}') \ + && export urlHugoBase="https://github.com/gohugoio/hugo/releases/download" \ + && export urlHugoBin="hugo_${urlHugoVersion}_linux-${arch}.deb" \ + && export urlHugo="${urlHugoBase}/v${urlHugoVersion}/${urlHugoBin}" \ + && curl --output /tmp/${urlHugoBin} -L ${urlHugo} \ + && sudo dpkg -i /tmp/${urlHugoBin} \ + && which hugo \ + && hugo version \ + && rm -rf /tmp/* \ && true -# Install helm -# TODO: relocate install to devcontainer.json -RUN set -ex \ - && export varVerHelm="$(curl -s https://api.github.com/repos/helm/helm/releases/latest | awk -F '[\"v,]' '/tag_name/{print $5}')" \ - && export varUrlHelm="https://get.helm.sh/helm-v${varVerHelm}-linux-amd64.tar.gz" \ - && curl -L ${varUrlHelm} | tar xzvf - --directory /tmp linux-amd64/helm \ - && chmod +x /tmp/linux-amd64/helm \ - && sudo mv /tmp/linux-amd64/helm /usr/local/bin/helm \ - && helm version \ - && rm -rf /tmp/linux-amd64 \ - && true +## Install kind (kubernetes-in-docker) +## TODO: relocate install to devcontainer.json +#RUN set -ex \ +# && export arch=$(uname -m | awk '{ if ($1 == "x86_64") print "amd64"; else if ($1 == "aarch64" || $1 == "arm64") print "arm64"; else print "unknown" }') \ +# && export urlKindRelease="https://api.github.com/repos/kubernetes-sigs/kind/releases/latest" \ +# && export urlKindVersion=$(curl -s ${urlKindRelease} | awk -F '["v,]' '/tag_name/{print $5}') \ +# && export urlKindBase="https://github.com/kubernetes-sigs/kind/releases/download" \ +# && export urlKindBin="kind-linux-${arch}" \ +# && export urlKind="${urlKindBase}/v${urlKindVersion}/${urlKindBin}" \ +# && sudo curl -L ${urlKind} --output /usr/local/bin/kind \ +# && sudo chmod +x /usr/local/bin/kind \ +# && which kind \ +# && kind version \ +# && true +# +## Install kubectl +## TODO: relocate install to devcontainer.json +#RUN set -ex \ +# && export arch=$(uname -m | awk '{ if ($1 == "x86_64") print "amd64"; else if ($1 == "aarch64" || $1 == "arm64") print "arm64"; else print "unknown" }') \ +# && export varKubectlVersion="$(curl --silent -L https://storage.googleapis.com/kubernetes-release/release/stable.txt | sed 's/v//g')" \ +# && export varKubectlUrl="https://storage.googleapis.com/kubernetes-release/release/v${varKubectlVersion}/bin/linux/${arch}/kubectl" \ +# && sudo curl -L ${varKubectlUrl} --output /usr/local/bin/kubectl \ +# && sudo chmod +x /usr/local/bin/kubectl \ +# && kubectl version --client || true \ +# && true +# +## Install helm +## TODO: relocate install to devcontainer.json +#RUN set -ex \ +# && export varVerHelm="$(curl -s https://api.github.com/repos/helm/helm/releases/latest | awk -F '[\"v,]' '/tag_name/{print $5}')" \ +# && export varUrlHelm="https://get.helm.sh/helm-v${varVerHelm}-linux-amd64.tar.gz" \ +# && curl -L ${varUrlHelm} | tar xzvf - --directory /tmp linux-amd64/helm \ +# && chmod +x /tmp/linux-amd64/helm \ +# && sudo mv /tmp/linux-amd64/helm /usr/local/bin/helm \ +# && helm version \ +# && rm -rf /tmp/linux-amd64 \ +# && true WORKDIR /workspaces CMD ["/usr/bin/zsh"] -# Hugo Development Web Server Port for pulumi/pulumi-hugo -EXPOSE 1313 - # GHCR Labels LABEL org.opencontainers.image.licenses="APACHE2" LABEL org.opencontainers.image.source="https://github.com/pulumi/devcontainer" diff --git a/devcontainer.json b/devcontainer.json index 2d4948a..da70b61 100644 --- a/devcontainer.json +++ b/devcontainer.json @@ -5,9 +5,6 @@ { "name": "pulumi", "image": "ghcr.io/pulumi/devcontainer", - "settings": { - "terminal.integrated.shell.linux": "/usr/bin/zsh" - }, "customizations": { "vscode": { "settings": [ @@ -23,6 +20,7 @@ "editor.gotoLocation.multipleDeclarations", "goto", "editor.gotoLocation.multipleImplementations", "goto", "editor.gotoLocation.multipleTypeDefinitions", "goto", + "terminal.integrated.shell.linux": "/usr/bin/zsh", "files.trimTrailingWhitespace", true, "files.trimFinalNewlines", true ], @@ -44,14 +42,27 @@ } }, "features": { - "ghcr.io/devcontainers/features/common-utils:2": {}, + "ghcr.io/devcontainers/features/common-utils:2": { + "installZsh": true, + "configureZshAsDefaultShell": true, + "installOhMyZsh": true, + "installOhMyZshConfig": true, + "upgradePackages": true, + "nonFreePackages": true, + "username": "vscode", + "userUid": "automatic", + "userGid": "automatic" + }, "ghcr.io/devcontainers/features/docker-outside-of-docker:1": { - "version": "latest", - "installDockerBuildx": true, - "moby": false + "moby": false, + "installDockerBuildx": true, + "version": "latest", + "dockerDashComposeVersion": "v2" } }, "postCreateCommand": "git submodule update --init --recursive", "remoteUser": "vscode", + "forwardPorts": [1313], "runArgs": ["--network=host"] } + diff --git a/team-docs/devcontainer.json b/team-docs/devcontainer.json deleted file mode 100644 index 3162362..0000000 --- a/team-docs/devcontainer.json +++ /dev/null @@ -1,61 +0,0 @@ -// Reference: -// - https://containers.dev/features -// - https://containers.dev/implementors/features -// - https://code.visualstudio.com/docs/getstarted/settings -{ - "name": "pulumi", - "image": "ghcr.io/pulumi/devcontainer", - "settings": { - "terminal.integrated.shell.linux": "/usr/bin/zsh" - }, - "customizations": { - "vscode": { - "settings": [ - "go.testTags", "all", - "go.buildTags", "all", - "editor.minimap.enabled", false, - "explorer.openEditors.visible", 1, - "editor.quickSuggestionsDelay", 0, - "editor.suggestSelection", "first", - "editor.snippetSuggestions", "top", - "editor.gotoLocation.multipleReferences", "goto", - "editor.gotoLocation.multipleDefinitions", "goto", - "editor.gotoLocation.multipleDeclarations", "goto", - "editor.gotoLocation.multipleImplementations", "goto", - "editor.gotoLocation.multipleTypeDefinitions", "goto", - "files.trimTrailingWhitespace", true, - "files.trimFinalNewlines", true - ], - "extensions": [ - "golang.go", - "vscodevim.vim", - "github.copilot", - "ms-python.python", - "jetpack-io.devbox", - "redhat.vscode-yaml", - "esbenp.prettier-vscode", - "ms-vscode.makefile-tools", - "ms-azuretools.vscode-docker", - "github.vscode-pull-request-github", - "ms-vscode-remote.remote-containers", - "visualstudioexptteam.vscodeintellicode", - "bierner.markdown-preview-github-styles" - ] - } - }, - "features": { - "ghcr.io/devcontainers/features/hugo:1": { - "version": "0.96.0" - }, - "ghcr.io/devcontainers/features/common-utils:2": {}, - "ghcr.io/devcontainers/features/docker-outside-of-docker:1": { - "version": "latest", - "installDockerBuildx": true, - "moby": false - } - }, - "postCreateCommand": "git submodule update --init --recursive", - "remoteUser": "vscode", - "forwardPorts": [1313], - "runArgs": ["--network=host"] -}