Skip to content

Commit

Permalink
extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
rschlaefli committed Oct 27, 2023
1 parent 0d2989e commit 1b6f157
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 18 deletions.
7 changes: 4 additions & 3 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM mcr.microsoft.com/devcontainers/javascript-node:1-20-bullseye
FROM mcr.microsoft.com/devcontainers/javascript-node:1-18-bullseye

# [Optional] Uncomment this section to install additional OS packages.
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
Expand All @@ -8,5 +8,6 @@ FROM mcr.microsoft.com/devcontainers/javascript-node:1-20-bullseye
# 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>"
RUN su node -c "npm install --global pnpm@8" \
&& su node -c "SHELL=bash pnpm setup" \
&& su node -c "pnpm config set store-dir /home/node/.local/share/pnpm/store"
6 changes: 2 additions & 4 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
// 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",
"name": "KlickerUZH Dev Container",
"dockerComposeFile": "docker-compose.yml",
"service": "app",
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
"features": {
}

// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},
Expand All @@ -16,7 +14,7 @@
// "forwardPorts": [3000, 5432],

// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "yarn install",
"postCreateCommand": "pnpm install"

// Configure tool-specific properties.
// "customizations": {},
Expand Down
50 changes: 39 additions & 11 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,51 @@ services:
command: sleep infinity

# Runs app on the same network as the database container, allows "forwardPorts" in devcontainer.json function.
network_mode: service:db
network_mode: service:postgres

# 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: docker.io/library/postgres:latest
restart: unless-stopped
reverse_proxy_docker:
image: docker.io/library/traefik:v2.10
command:
- --api.insecure=true
- --providers.file=true
- --providers.file.filename=/etc/traefik/rules.yaml
- --providers.file.watch=true
- --entrypoints.web.address=:80
ports:
- 8088:80
- 8080:8080
volumes:
- postgres-data:/var/lib/postgresql/data
- '../util/traefik/rules_devcontainer.yaml:/etc/traefik/rules.yaml'

# main database
postgres:
image: docker.io/library/postgres:15
environment:
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
POSTGRES_DB: postgres
POSTGRES_USER: klicker
POSTGRES_PASSWORD: klicker
POSTGRES_DB: klicker
ports:
- 5432:5432
volumes:
- postgres_data:/var/lib/postgresql/data

# Add "forwardPorts": ["5432"] to **devcontainer.json** to forward PostgreSQL locally.
# (Adding the "ports" property to this file will not forward from a Codespace.)
# redis instance to support session execution
redis_exec:
image: docker.io/library/redis:7
ports:
- 6379:6379
volumes:
- redis_data:/data

# redis instance for page caching and rate limiting
redis_cache:
image: docker.io/library/redis:7
ports:
- 6380:6379

volumes:
postgres-data:
postgres_data:
redis_data:

0 comments on commit 1b6f157

Please sign in to comment.