Skip to content

Commit

Permalink
Set up devcontainer
Browse files Browse the repository at this point in the history
  • Loading branch information
reachfh committed Jan 6, 2024
1 parent bd24f13 commit 19a5b79
Show file tree
Hide file tree
Showing 3 changed files with 117 additions and 0 deletions.
55 changes: 55 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/docker-existing-docker-compose
{
"name": "foo-app",

// Update the 'dockerComposeFile' list if you have more compose files or use different names.
// The .devcontainer/docker-compose.yml file contains any overrides you need/want to make.
"dockerComposeFile": [
"../docker-compose.gha.yml",
"docker-compose.yml"
],

// The 'service' property is the name of the service for the container that VS Code should
// use. Update this value and .devcontainer/docker-compose.yml to the real service name.
"service": "dev",

// The optional 'workspaceFolder' property is the path VS Code should open by default when
// connected. This is typically a file mount in .devcontainer/docker-compose.yml
// "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}"
"workspaceFolder": "/app",

// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"jakebecker.elixir-ls"
],

"customizations": {
"vscode": {
"extensions": [
"ms-vscode-remote.remote-containers"
]
}
},
// 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": [],
"forwardPorts": [4000, 4001, 5432],

// Uncomment the next line if you want start specific services in your Docker Compose config.
"runServices": ["dev"],

// Uncomment the next line if you want to keep your containers running after VS Code shuts down.
// "shutdownAction": "none",

// Uncomment the next line to run commands after the container is created.
// "postCreateCommand": "cat /etc/os-release",

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

// Uncomment to connect as an existing user other than the container default. More info: https://aka.ms/dev-containers-non-root.
"remoteUser": "nonroot"
}
27 changes: 27 additions & 0 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
version: '3.9'
services:
# Update this to the name of the service you want to work with in your docker-compose.yml file
dev:
# Uncomment if you want to override the service's Dockerfile to one in the .devcontainer
# folder. Note that the path of the Dockerfile and context is relative to the *primary*
# docker-compose.yml file (the first in the devcontainer.json "dockerComposeFile"
# array). The sample below assumes your primary file is in the root of your project.
#
# build:
# context: .
# dockerfile: .devcontainer/Dockerfile

# volumes:
# # Update this to wherever you want VS Code to mount the folder of your project
# - ..:/app:cached

# Uncomment the next four lines if you will use a ptrace-based debugger like C++, Go, and Rust.
# cap_add:
# - SYS_PTRACE
# security_opt:
# - seccomp:unconfined

# Overrides default command so things don't shut down after the process ends.
command: /bin/sh -c "while sleep 1000; do :; done"
# command: sleep infinity
35 changes: 35 additions & 0 deletions docker-compose.gha.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,41 @@ services:
# aws-otel-collector:
# condition: service_healthy

# Development image
dev:
image: "${REGISTRY:-docker.io/}${IMAGE_OWNER}/${IMAGE_NAME}:dev"
build:
dockerfile: ${DOCKER_FILE:-deploy/debian.Dockerfile}
target: dev
args:
BUILDKIT_INLINE_CACHE: "1"
REGISTRY: ${REGISTRY:-docker.io/}
PUBLIC_REGISTRY: ${REGISTRY:-docker.io/}
context: .
# secrets:
# - oban_license_key
# - oban_key_fingerprint
# - access_token
# VSCode devcontainer needs something running
# command: /bin/sh -c "while sleep 1000; do :; done"
environment:
- DATABASE_DB
- DATABASE_HOST=${DATABASE_HOST:-postgres}
- DATABASE_URL
- SECRET_KEY_BASE=${SECRET_KEY_BASE:-0cSFk8v5IsZIIGCjY+X66l5xULUl/2mczI4Eqf7slpyns5nBkhegDn6YH9th+5D2}
ports:
- '4000:4000'
stdin_open: true
tty: true
cap_add:
- CAP_SYS_ADMIN
volumes:
- ".:/app:delegated"
# - 'nfsmount:/app'
depends_on:
postgres:
condition: service_healthy

# https://github.com/aws-observability/aws-otel-collector/blob/main/docs/developers/docker-demo.md
aws-otel-collector:
image: public.ecr.aws/aws-observability/aws-otel-collector:latest
Expand Down

0 comments on commit 19a5b79

Please sign in to comment.