Skip to content

Commit

Permalink
feat: add devcontainer (googleapis#8512)
Browse files Browse the repository at this point in the history
* feat: add devcontainer for github codespaces

* feat: remove unwanted code
  • Loading branch information
harshachinta authored Sep 15, 2023
1 parent ab58ecf commit 9f8b5bf
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
ARG VARIANT="1-1.21-bullseye"
FROM mcr.microsoft.com/devcontainers/go:${VARIANT}

RUN apt-get update && export DEBIAN_FRONTEND=noninteractive

RUN type -p curl >/dev/null || (apt-get install curl -y)


# install gloud sdk
RUN echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] http://packages.cloud.google.com/apt cloud-sdk main" | tee -a /etc/apt/sources.list.d/google-cloud-sdk.list && curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key --keyring /usr/share/keyrings/cloud.google.gpg add - && apt-get update -y && apt-get install google-cloud-cli -y
18 changes: 18 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/go
{
"name": "Go 1.21.0",
"build": {
"dockerfile": "Dockerfile"
},
// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "bash .devcontainer/postCreate.sh",
// Configure tool-specific properties.
"customizations": {
"vscode": {
"extensions": [
"ms-azuretools.vscode-docker"
]
}
}
}
4 changes: 4 additions & 0 deletions .devcontainer/postCreate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
echo "Post Create Starting"

go version
go mod tidy

0 comments on commit 9f8b5bf

Please sign in to comment.