Skip to content

Commit

Permalink
Add MariaDB & PostgreSQL templates
Browse files Browse the repository at this point in the history
  • Loading branch information
marcosgomesneto committed Feb 7, 2024
1 parent 0fd8ccc commit 70570ea
Show file tree
Hide file tree
Showing 12 changed files with 198 additions and 2 deletions.
2 changes: 0 additions & 2 deletions src/basic-bun/.devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
FROM oven/bun:${templateOption:imageVariant}

RUN apt-get update

#RUN apt-get update && apt-get install -y git
2 changes: 2 additions & 0 deletions src/basic-bun/.devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/marcosgomesneto/bun-devcontainers/tree/main/src/basic-bun
{
"name": "Bun",
"dockerFile": "Dockerfile",
Expand Down
3 changes: 3 additions & 0 deletions src/bun-mariadb/.devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM oven/bun:${templateOption:imageVariant}

RUN apt-get update
23 changes: 23 additions & 0 deletions src/bun-mariadb/.devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/marcosgomesneto/bun-devcontainers/tree/main/src/bun-mariadb
{
"name": "PHP & MariaDB",
"dockerComposeFile": "docker-compose.yml",
"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.
"forwardPorts": [8080, 3306]

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

// Configure tool-specific properties.
// "customizations": {},

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
36 changes: 36 additions & 0 deletions src/bun-mariadb/.devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
version: "3.8"

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: mariadb:10.4
restart: unless-stopped
volumes:
- mariadb-data:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: mariadb
MYSQL_DATABASE: mariadb
MYSQL_USER: mariadb
MYSQL_PASSWORD: mariadb

# Add "forwardPorts": ["3306"] to **devcontainer.json** to forward MariaDB locally.
# (Adding the "ports" property to this file will not forward from a Codespace.)

volumes:
mariadb-data:
27 changes: 27 additions & 0 deletions src/bun-mariadb/devcontainer-template.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"id": "bun-mariadb",
"version": "0.0.1",
"name": "Bun & MariaDB",
"description": "Develop applications in Bun and MariaDB.",
"publisher": "Marcos Gomes Neto",
"documentationURL": "https://github.com/marcosgomesneto/bun-devcontainers/tree/main/src/bun-mariadb",
"licenseURL": "https://github.com/marcosgomesneto/bun-devcontainers/blob/main/LICENSE",
"options": {
"imageVariant": {
"type": "string",
"description": "Choose your Bun image tag.",
"proposals": [
"latest",
"canary-distroless",
"canary-slim",
"canary"
],
"default": "latest"
}
},
"platforms": [
"Bun",
"TypeScript",
"MariaDB (MySQL Compatible)"
]
}
3 changes: 3 additions & 0 deletions src/bun-postgresql/.devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM oven/bun:${templateOption:imageVariant}

RUN apt-get update
24 changes: 24 additions & 0 deletions src/bun-postgresql/.devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/marcosgomesneto/bun-devcontainers/tree/main/src/bun-postgresql
{
"name": "Bun & PostgreSQL",
"dockerComposeFile": "docker-compose.yml",
"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": [8080, 5432],

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

// Configure tool-specific properties.
// "customizations": {},

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
35 changes: 35 additions & 0 deletions src/bun-postgresql/.devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
version: "3.8"

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:
27 changes: 27 additions & 0 deletions src/bun-postgresql/devcontainer-template.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"id": "bun-postgresql",
"version": "0.0.1",
"name": "Bun & PostgreSQL",
"description": "Develop applications in Bun and PostgreSQL.",
"publisher": "Marcos Gomes Neto",
"documentationURL": "https://github.com/marcosgomesneto/bun-devcontainers/tree/main/src/bun-postgresql",
"licenseURL": "https://github.com/marcosgomesneto/bun-devcontainers/blob/main/LICENSE",
"options": {
"imageVariant": {
"type": "string",
"description": "Choose your Bun image tag.",
"proposals": [
"latest",
"canary-distroless",
"canary-slim",
"canary"
],
"default": "latest"
}
},
"platforms": [
"Bun",
"TypeScript",
"PostgreSQL"
]
}
9 changes: 9 additions & 0 deletions test/bun-mariadb/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash
cd $(dirname "$0")
source test-utils.sh

# Template specific tests
check "bun" type bun

# Report result
reportResults
9 changes: 9 additions & 0 deletions test/bun-postgresql/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash
cd $(dirname "$0")
source test-utils.sh

# Template specific tests
check "bun" type bun

# Report result
reportResults

0 comments on commit 70570ea

Please sign in to comment.