Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: Support GitHub Codespace development (#1434)
* First pass at sqlc codespace * Attempt to make CI tests pass in dev containers * Use default network mode
- Loading branch information
1 parent
323187f
commit 194065e
Showing
4 changed files
with
113 additions
and
1 deletion.
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# [Choice] Go version (use -bullseye variants on local arm64/Apple Silicon): 1, 1.16, 1.17, 1-bullseye, 1.16-bullseye, 1.17-bullseye, 1-buster, 1.16-buster, 1.17-buster | ||
ARG VARIANT=1.17-bullseye | ||
FROM mcr.microsoft.com/vscode/devcontainers/go:0-${VARIANT} | ||
|
||
# [Optional] If your requirements rarely change, uncomment this section to add them to the image. | ||
# COPY requirements.txt /tmp/pip-tmp/ | ||
# RUN pip3 --disable-pip-version-check --no-cache-dir install -r /tmp/pip-tmp/requirements.txt \ | ||
# && rm -rf /tmp/pip-tmp | ||
|
||
# [Optional] Uncomment this section to install additional OS packages. | ||
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ | ||
# && apt-get -y install --no-install-recommends <your-package-list-here> | ||
|
||
|
||
|
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 @@ | ||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: | ||
// https://github.com/microsoft/vscode-dev-containers/tree/v0.209.6/containers/python-3-postgres | ||
// Update the VARIANT arg in docker-compose.yml to pick a Python version | ||
{ | ||
"name": "sqlc", | ||
"dockerComposeFile": "docker-compose.yml", | ||
"service": "app", | ||
"workspaceFolder": "/workspace", | ||
|
||
"runArgs": [ "--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined" ], | ||
|
||
// Set *default* container specific settings.json values on container create. | ||
"settings": { | ||
"sqltools.connections": [{ | ||
"name": "Container database", | ||
"driver": "PostgreSQL", | ||
"previewLimit": 50, | ||
"server": "postgresql", | ||
"port": 5432, | ||
"database": "dinotest", | ||
"username": "postgres", | ||
"password": "mysecretpassword" | ||
}], | ||
"go.toolsManagement.checkForUpdates": "local", | ||
"go.useLanguageServer": true, | ||
"go.gopath": "/go", | ||
"go.goroot": "/usr/local/go" | ||
}, | ||
|
||
// Add the IDs of extensions you want installed when the container is created. | ||
"extensions": [ | ||
"golang.Go", | ||
"mtxr.sqltools", | ||
"mtxr.sqltools-driver-pg", | ||
"mtxr.sqltools-driver-mysql" | ||
], | ||
|
||
// Use 'forwardPorts' to make a list of ports inside the container available locally. | ||
// "forwardPorts": [5000, 5432], | ||
|
||
// 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
version: '3.8' | ||
|
||
services: | ||
app: | ||
build: | ||
context: .. | ||
dockerfile: .devcontainer/Dockerfile | ||
args: | ||
VARIANT: 1.17-bullseye | ||
|
||
volumes: | ||
- ..:/workspace:cached | ||
|
||
# Overrides default command so things don't shut down after the process ends. | ||
command: sleep infinity | ||
|
||
environment: | ||
PG_HOST: postgresql | ||
PG_USER: postgres | ||
PG_DATABASE: dinotest | ||
PG_PASSWORD: mysecretpassword | ||
MYSQL_DATABASE: dinotest | ||
MYSQL_HOST: mysql | ||
MYSQL_ROOT_PASSWORD: mysecretpassword | ||
|
||
mysql: | ||
image: "mysql:8" | ||
ports: | ||
- "3306:3306" | ||
restart: unless-stopped | ||
environment: | ||
MYSQL_DATABASE: dinotest | ||
MYSQL_ROOT_PASSWORD: mysecretpassword | ||
|
||
postgresql: | ||
image: "postgres:13" | ||
ports: | ||
- "5432:5432" | ||
restart: unless-stopped | ||
environment: | ||
POSTGRES_DB: dinotest | ||
POSTGRES_PASSWORD: mysecretpassword | ||
POSTGRES_USER: postgres | ||
|
||
# Add "forwardPorts": ["5432"] to **devcontainer.json** to forward PostgreSQL locally. | ||
# (Adding the "ports" property to this file will not forward from a Codespace.) |
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