add dev environment
All checks were successful
MediaManager API CI / Build api Docker images (push) Successful in 2m21s
MediaManager Frontend CI / Build frontend Docker images (push) Successful in 2m19s
MediaManager Scraper Boxnovel CI / Build Scraper Boxnovel Docker images (push) Successful in 2m4s

This commit is contained in:
2025-01-04 22:27:40 +01:00
parent 7b309a1e52
commit a555beef44
6 changed files with 93 additions and 1 deletions

0
.devcontainer/.gitignore vendored Normal file
View File

7
.devcontainer/Dockerfile Normal file
View File

@@ -0,0 +1,7 @@
FROM mcr.microsoft.com/devcontainers/rust:1-1-bookworm
# Include lld linker to improve build times either by using environment variable
# RUSTFLAGS="-C link-arg=-fuse-ld=lld" or with Cargo's configuration file (i.e see .cargo/config.toml).
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get -y install clang lld npm \
&& apt-get autoremove -y && apt-get clean -y

View File

@@ -0,0 +1,35 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/rust-postgres
{
"name": "Rust and PostgreSQL",
// "dockerComposeFile": ["../../docker-compose.dev.yaml", "docker-compose.yml"],
"dockerComposeFile": "docker-compose.yml",
"service": "rust-services",
"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.
// "forwardPorts": [5432],
// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": ".devcontainer/post-create.sh",
"customizations": {
"vscode": {
"extensions": [
"rangav.vscode-thunder-client",
"redhat.vscode-xml"
]
}
},
"features": {
"ghcr.io/jayree/devcontainer-features/npm-registry:1": {}
}
// Configure tool-specific properties.
// "customizations": {},
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}

View File

@@ -0,0 +1,48 @@
volumes:
postgres-data:
services:
rust-services:
# build:
# context: ./services
# dockerfile: .devcontainer/Dockerfile
build:
context: .
dockerfile: Dockerfile
# env_file:
# # Ensure that the variables in .env match the same variables in devcontainer.json
# - .env
volumes:
- ../..:/workspaces:cached
ports:
- 3000:3000
- 8080:8080
# 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:17
restart: unless-stopped
volumes:
- postgres-data:/var/lib/postgresql/data
- ./tmp:/tmp
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: mediamanager
# env_file:
# # Ensure that the variables in .env match the same variables in devcontainer.json
# - .env
# Add "forwardPorts": ["5432"] to **devcontainer.json** to forward PostgreSQL locally.
# (Adding the "ports" property to this file will not forward from a Codespace.)

1
.devcontainer/post-create.sh Executable file
View File

@@ -0,0 +1 @@
cargo install cargo-watch

3
.gitignore vendored
View File

@@ -3,6 +3,7 @@
!.gitignore
!.gitea
!.cargo
!.devcontainer
# -- Rust
# For .cargo/config.toml
@@ -38,4 +39,4 @@ report.*.json
*.jpeg
*.jpg
*.gif
*.png
*.png