-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Add devcontainer.json, Dockerfile and compose.yaml for self-bu…
…ild development container
- Loading branch information
Showing
3 changed files
with
85 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
FROM mcr.microsoft.com/devcontainers/javascript-node:1-20-bookworm | ||
|
||
RUN npm uninstall -g pnpm && corepack enable pnpm | ||
|
||
# [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> | ||
|
||
# [Optional] Uncomment if you want to install an additional version of node using nvm | ||
# ARG EXTRA_NODE_VERSION=10 | ||
# RUN su node -c "source /usr/local/share/nvm/nvm.sh && nvm install ${EXTRA_NODE_VERSION}" | ||
|
||
# [Optional] Uncomment if you want to install more global node modules | ||
# RUN su node -c "npm install -g <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,34 @@ | ||
|
||
services: | ||
app: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
|
||
volumes: | ||
- ../../..:/workspaces:cached | ||
|
||
# Overrides default command so things don't shut down after the process ends. | ||
command: sleep infinity | ||
|
||
# Runs app on the same network as the database container, allows "forwardPorts" in devcontainer.json function. | ||
network_mode: service:db | ||
|
||
# Use "forwardPorts" in **devcontainer.json** to forward an app port locally. | ||
# (Adding the "ports" property to this file will not forward from a Codespace.) | ||
|
||
db: | ||
image: postgres:latest | ||
restart: unless-stopped | ||
volumes: | ||
- postgres-data:/var/lib/postgresql/data | ||
environment: | ||
POSTGRES_PASSWORD: postgres | ||
POSTGRES_USER: postgres | ||
POSTGRES_DB: postgres | ||
|
||
# Add "forwardPorts": ["5432"] to **devcontainer.json** to forward PostgreSQL locally. | ||
# (Adding the "ports" property to this file will not forward from a Codespace.) | ||
|
||
volumes: | ||
postgres-data: |
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,37 @@ | ||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the | ||
// README at: https://github.com/devcontainers/templates/tree/main/src/javascript-node-postgres | ||
{ | ||
"name": "Node.js & PostgreSQL", | ||
"dockerComposeFile": "compose.yaml", | ||
"service": "app", | ||
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}", | ||
|
||
// Features to add to the dev container. More info: https://containers.dev/features. | ||
// "features": {}, | ||
|
||
// Use 'forwardPorts' to make a list of ports inside the container available locally. | ||
// This can be used to network with other containers or with the host. | ||
// "forwardPorts": [3000, 5432], | ||
|
||
// Use 'postCreateCommand' to run commands after the container is created. | ||
"postCreateCommand": "corepack prepare && pnpm i --frozen-lockfile", | ||
|
||
// Configure tool-specific properties. | ||
"customizations": { | ||
"vscode": { | ||
"settings": { | ||
"editor.defaultFormatter": "biomejs.biome", | ||
"editor.formatOnSave": true | ||
}, | ||
"extensions": ["biomejs.biome"] | ||
} | ||
}, | ||
|
||
"remoteEnv": { | ||
"POSTGRES_URL": "postgresql://postgres:postgres@localhost:5432/postgres", | ||
"AUDIT_LOG_WEBHOOK": "https://httpbin.org/status/200" | ||
} | ||
|
||
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. | ||
// "remoteUser": "root" | ||
} |