aboutsummaryrefslogtreecommitdiff
path: root/.devcontainer
diff options
context:
space:
mode:
Diffstat (limited to '.devcontainer')
-rw-r--r--.devcontainer/devcontainer.json18
-rw-r--r--.devcontainer/docker-compose.yml48
2 files changed, 52 insertions, 14 deletions
diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json
index 9e846c0..a89c455 100644
--- a/.devcontainer/devcontainer.json
+++ b/.devcontainer/devcontainer.json
@@ -2,19 +2,9 @@
// https://github.com/microsoft/vscode-dev-containers/tree/v0.209.6/containers/java
{
"name": "Java",
- "build": {
- "dockerfile": "Dockerfile",
- "args": {
- // Update the VARIANT arg to pick a Java version: 11, 17
- // Append -bullseye or -buster to pin to an OS version.
- // Use the -bullseye variants on local arm64/Apple Silicon.
- "VARIANT": "17",
- // Options
- "INSTALL_MAVEN": "true",
- "INSTALL_GRADLE": "false",
- "NODE_VERSION": "lts/*"
- }
- },
+ "dockerComposeFile": "docker-compose.yml",
+ "service": "pantry",
+ "workspaceFolder": "/workspace",
// Set *default* container specific settings.json values on container create.
"settings": {
@@ -30,7 +20,7 @@
// "forwardPorts": [],
// Use 'postCreateCommand' to run commands after the container is created.
- // "postCreateCommand": "java -version",
+ "postCreateCommand": "mvn dependency:resolve",
// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode",
diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml
new file mode 100644
index 0000000..2818283
--- /dev/null
+++ b/.devcontainer/docker-compose.yml
@@ -0,0 +1,48 @@
+version: '3'
+
+services:
+ pantry:
+ build:
+ context: .
+ dockerfile: Dockerfile
+ args:
+ # Volume directory for hosted files. This directory is created on image build with proper permissions. This is set as an env-var in the Dockerfile
+ VARIANT: "17"
+
+ # Options
+ INSTALL_MAVEN: "true"
+ INSTALL_GRADLE: "false"
+ NODE_VERSION: "lts/*"
+
+ environment:
+ MARIADB_HOST: "pantry-db"
+
+ volumes:
+ - ..:/workspace: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:pantry-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.)
+
+ pantry-db:
+ image: mariadb:10.7
+ restart: unless-stopped
+ volumes:
+ - pantrydb-data:/var/lib/mysql
+
+ environment:
+ MARIADB_RANDOM_ROOT_PASSWORD: "true"
+ MARIADB_DATABASE: "pantry-db"
+ MARIADB_USER: "pantry-user"
+ MARIADB_PASSWORD: "i2j9ds0g"
+
+ # Add "forwardPorts": ["27017"] to **devcontainer.json** to forward MongoDB locally.
+ # (Adding the "ports" property to this file will not forward from a Codespace.)
+
+volumes:
+ pantrydb-data: \ No newline at end of file