Created
October 30, 2024 20:42
-
-
Save cannikin/e2c7024ee3966f0fbf4817d6fe712909 to your computer and use it in GitHub Desktop.
RedwoodJS Devcontainer Config: place these 3 files in a `.devcontainer` directory at the root of your RedwoodJS app
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
name: 'project_name' | |
services: | |
app: | |
build: | |
context: .. | |
dockerfile: .devcontainer/Dockerfile | |
volumes: | |
- ../..:/workspaces:cached | |
command: sleep infinity | |
depends_on: | |
- mysql | |
# See note about network below | |
networks: | |
- dev-network | |
# I'm using MySQL but this could easily be Postgres. | |
# If you wanted SQLite you can do that inside the Dockerfile | |
# itself, just `RUN apt update && apt install -y sqlite` | |
# no need to have a separate container running here | |
mysql: | |
image: mysql:8 | |
restart: unless-stopped | |
environment: | |
MYSQL_ROOT_PASSWORD: password | |
MYSQL_DATABASE: 128collective | |
MYSQL_USER: user | |
MYSQL_PASSWORD: password | |
ports: | |
- "3306:3306" | |
networks: | |
- dev-network | |
# If you don't have MySQL or Postgres running then you can remove | |
# this network setup | |
networks: | |
dev-network: | |
driver: bridge |
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
Show hidden characters
// If you're using SQLite you can simplify your setup to just have | |
// this one file and include "image": "node:20" here instead of | |
// needing separate Dockerfile and compose.yaml files. Remove the | |
// "dockerComposeFile" property and update "postCreateCommand" to: | |
// "COREPACK_ENABLE_DOWNLOAD_PROMPT=0 corepack enable && yarn install" | |
{ | |
"name": "project_name", | |
"dockerComposeFile": "compose.yaml", | |
"service": "app", | |
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}", | |
"forwardPorts": [8910, 8911], | |
"postCreateCommand": "yarn install", | |
"customizations": { | |
"vscode": { | |
"extensions": [] | |
} | |
} | |
} |
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
FROM node:20 | |
ENV COREPACK_ENABLE_DOWNLOAD_PROMPT=0 | |
RUN corepack enable |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment