-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- update devcontainer.json to customizations spec - switch to modern container repository and pin to 1.22-bullseye (same as go.mod) - install protoc as part of container setup, and its deps https://github.com/ericslandry/grpc/blob/dcc9b228a2189933b0666eeea23852a12225092b/.devcontainer/post-create.sh
- Loading branch information
Showing
7 changed files
with
88 additions
and
30 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,9 +1,9 @@ | ||
ARG VARIANT=1-bullseye | ||
FROM mcr.microsoft.com/vscode/devcontainers/go:0-${VARIANT} | ||
# Should match go version in go.mod | ||
FROM mcr.microsoft.com/devcontainers/go:1.22-bullseye | ||
|
||
ARG NODE_VERSION="none" | ||
RUN if [ "${NODE_VERSION}" != "none" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi | ||
|
||
RUN apt-get update && apt-get install redis build-essential libpng-dev -y | ||
RUN apt-get update && apt-get install -y redis build-essential libpng-dev | ||
|
||
ENTRYPOINT ["sleep", "infinity"] |
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,25 @@ | ||
#!/usr/bin/env bash | ||
set -ex | ||
|
||
# Install protoc (used by go:generate) and add it to path | ||
# Not done in Dockerfile because it seems to lock out writing to some files go needs to write to? | ||
version=25.4 | ||
PB_REL="https://github.com/protocolbuffers/protobuf/releases" | ||
curl -LO $PB_REL/download/v$version/protoc-$version-linux-x86_64.zip | ||
unzip protoc-$version-linux-x86_64.zip -d $HOME/.local/ | ||
export PATH="$PATH:$HOME/.local/bin" | ||
go install google.golang.org/protobuf/cmd/[email protected] | ||
go install google.golang.org/grpc/cmd/[email protected] | ||
export PATH="$PATH:$(go env GOPATH)/bin" | ||
|
||
# Install libwebp (otherwise go:generate tries and fails to build it itself or something) | ||
# https://developers.google.com/speed/webp/docs/precompiled | ||
libwebp_version=1.4.0 | ||
libwebp_file="libwebp-$libwebp_version-linux-x86-64.tar.gz" | ||
curl -LO "https://storage.googleapis.com/downloads.webmproject.org/releases/webp/$libwebp_file" | ||
mkdir -p $HOME/libwebp | ||
tar xzvf $libwebp_file -C $HOME/libwebp | ||
export PATH="$PATH:$HOME/libwebp/bin" | ||
|
||
# Add as a safe git directory | ||
git config --global --add safe.directory "/workspaces/smr_api" |
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,40 +1,47 @@ | ||
{ | ||
"name": "Go", | ||
"name": "smr-api", | ||
"dockerComposeFile": "docker-compose.yml", | ||
"service": "app", | ||
"workspaceFolder": "/workspace", | ||
"workspaceFolder": "/workspaces/smr_api", | ||
"onCreateCommand": "./.devcontainer/create.sh", | ||
"updateContentCommand": "go mod download && go generate -tags tools -x ./...", | ||
|
||
// Add the IDs of extensions you want installed when the container is created. | ||
"extensions": [ | ||
"golang.Go", | ||
"mtxr.sqltools", | ||
"mtxr.sqltools-driver-pg" | ||
], | ||
"settings": { | ||
"go.toolsManagement.checkForUpdates": "local", | ||
"go.useLanguageServer": true, | ||
"go.gopath": "/go", | ||
"go.goroot": "/usr/local/go", | ||
"sqltools.connections": [ | ||
{ | ||
"name": "Container database", | ||
"driver": "PostgreSQL", | ||
"previewLimit": 50, | ||
"server": "localhost", | ||
"port": 5432, | ||
"database": "postgres", | ||
"username": "postgres", | ||
"password": "REPLACE_ME" | ||
"customizations": { | ||
"vscode": { | ||
"extensions": [ | ||
"golang.Go", | ||
"mtxr.sqltools", | ||
"mtxr.sqltools-driver-pg", | ||
"streetsidesoftware.code-spell-checker" | ||
], | ||
"settings": { | ||
"go.toolsManagement.checkForUpdates": "local", | ||
"go.useLanguageServer": true, | ||
"go.gopath": "/go", | ||
"go.goroot": "/usr/local/go", | ||
"sqltools.connections": [ | ||
{ | ||
"name": "Container database", | ||
"driver": "PostgreSQL", | ||
"previewLimit": 50, | ||
"server": "localhost", | ||
"port": 5432, | ||
"database": "postgres", | ||
"username": "postgres", | ||
"password": "REPLACE_ME" | ||
} | ||
] | ||
} | ||
] | ||
} | ||
}, | ||
"forwardPorts": [ | ||
5432, | ||
6379, | ||
9000, | ||
9001, | ||
5020, | ||
5020 | ||
], | ||
// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. | ||
"remoteUser": "vscode" | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// https://cspell.org/configuration/ | ||
{ | ||
// Version of the setting file. Always 0.2 | ||
"version": "0.2", | ||
// language - current active spelling language | ||
"language": "en", | ||
// words - list of words to be always considered correct | ||
"words": [ | ||
"golangci", | ||
"gopath", | ||
"goroot", | ||
"libwebp", | ||
"mtxr", | ||
"Paseto", | ||
"protoc", | ||
"svcacct" | ||
], | ||
// flagWords - list of words to be always considered incorrect | ||
// This is useful for offensive words and common spelling errors. | ||
// cSpell:disable (don't complain about the words we listed here) | ||
"flagWords": [ | ||
"hte", | ||
"comunity" | ||
] | ||
} |
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