use compose environment for devcontainer

- add redis container
This commit is contained in:
Jörn-Michael Miehe 2023-10-29 17:13:32 +01:00
parent b206b472bc
commit 2e50dd447d
2 changed files with 35 additions and 15 deletions

View file

@ -2,21 +2,9 @@
// README at: https://github.com/devcontainers/templates/tree/main/src/python // README at: https://github.com/devcontainers/templates/tree/main/src/python
{ {
"name": "Advent22 API", "name": "Advent22 API",
"build": { "dockerComposeFile": "docker-compose.yml",
"dockerfile": "Dockerfile", "service": "api",
"context": "..", "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
"args": {
// Update 'VARIANT' to pick a Python version.
// Append -bullseye or -buster to pin to an OS version.
// Use -bullseye variants on local on arm64/Apple Silicon.
"VARIANT": "3.11-bookworm",
// Options
"NODE_VERSION": "none"
}
},
"containerEnv": {
"TZ": "Europe/Berlin"
},
// Configure tool-specific properties. // Configure tool-specific properties.
"customizations": { "customizations": {
// Configure properties specific to VS Code. // Configure properties specific to VS Code.

View file

@ -0,0 +1,32 @@
version: "3.8"
services:
api:
build:
context: "."
dockerfile: "Dockerfile"
args:
# Update 'VARIANT' to pick a Python version.
# Append -bookworm, -bullseye or -buster to pin to an OS version.
# Use -bookworm or -bullseye variants on local on arm64/Apple Silicon.
VARIANT: "3.11-bookworm"
NODE_VERSION: "none"
environment:
TZ: "Europe/Berlin"
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 redis container, allows "forwardPorts" in devcontainer.json function.
network_mode: "service:redis"
# Use "forwardPorts" in **devcontainer.json** to forward an app port locally.
# (Adding the "ports" property to this file will not forward from a Codespace.)
redis:
image: "redis:7"
restart: "unless-stopped"