Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
FROM mcr.microsoft.com/devcontainers/java:1-21-bullseye

# Install additional tools
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get -y install --no-install-recommends \
curl \
wget \
git \
unzip \
zip \
default-mysql-client \
vim \
lsof \
net-tools

# Install Docker CLI
RUN apt-get update && apt-get install -y \
ca-certificates \
curl \
gnupg \
lsb-release \
&& mkdir -p /etc/apt/keyrings \
&& curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg \
&& echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \
$(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null \
&& apt-get update \
&& apt-get install -y docker-ce-cli

# Clean up
RUN apt-get clean && rm -rf /var/lib/apt/lists/*

# Set the default user to vscode
USER vscode

# Set working directory
WORKDIR /workspace
73 changes: 73 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
{
"name": "Mofe API Dev Container",
"dockerComposeFile": ["../compose.yaml", "docker-compose.yml"],
Copy link

Copilot AI Feb 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The devcontainer.json references '../compose.yaml' in the dockerComposeFile array, but the compose.yaml file in the repository root defines different service configurations (mysql, mariadb, rabbitmq) with different environment variables than those used in docker-compose.yml. This could lead to confusion or conflicts. The devcontainer should either use only docker-compose.yml or the compose files should be harmonized to avoid configuration mismatches.

Suggested change
"dockerComposeFile": ["../compose.yaml", "docker-compose.yml"],
"dockerComposeFile": ["docker-compose.yml"],

Copilot uses AI. Check for mistakes.
"service": "app",
"workspaceFolder": "/workspace",
Copy link

Copilot AI Feb 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The workspaceFolder is set to "/workspace" but the volume mount maps to "/workspaces/mofe-api" (note the plural "workspaces"). This path mismatch will cause the devcontainer to not find the project files in the expected location, breaking the development environment setup.

Suggested change
"workspaceFolder": "/workspace",
"workspaceFolder": "/workspaces/mofe-api",

Copilot uses AI. Check for mistakes.
"shutdownAction": "stopCompose",

"features": {
"ghcr.io/devcontainers/features/java:1": {
"version": "21",
"installGradle": "true"
},
"ghcr.io/devcontainers/features/git:1": {}
},

"customizations": {
"vscode": {
"extensions": [
"vscjava.vscode-java-pack",
"fwcd.kotlin",
"ms-vscode.vscode-spring-initializr",
"vmware.vscode-spring-boot",
"vscjava.vscode-spring-boot-dashboard",
"gabrielbb.vscode-lombok",
"redhat.vscode-yaml",
"ms-vscode.vscode-json",
"bradlc.vscode-tailwindcss",
"esbenp.prettier-vscode",
"ms-vscode.vscode-docker"
],
"settings": {
"java.configuration.runtimes": [
{
"name": "JavaSE-21",
"path": "/usr/local/sdkman/candidates/java/current"
}
],
"java.compile.nullAnalysis.mode": "automatic",
"spring-boot.ls.logfile": {
"on": true
}
}
}
},

"forwardPorts": [8080, 3306, 5672, 15672],
"portsAttributes": {
"8080": {
"label": "Spring Boot App",
"onAutoForward": "notify"
},
"3306": {
"label": "MySQL/MariaDB"
},
"5672": {
"label": "RabbitMQ"
},
"15672": {
"label": "RabbitMQ Management"
}
},

"postCreateCommand": "chmod +x gradlew",
"postStartCommand": "sudo service docker start",
Copy link

Copilot AI Feb 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The postStartCommand attempts to start Docker with "sudo service docker start", but this command is unlikely to work in a devcontainer environment. Devcontainers typically use Docker-outside-of-Docker pattern where the Docker socket is mounted from the host. This command may fail or be unnecessary. Consider removing this command or using a different approach if Docker-in-Docker is truly needed.

Suggested change
"postStartCommand": "sudo service docker start",

Copilot uses AI. Check for mistakes.

"remoteEnv": {
"SPRING_PROFILES_ACTIVE": "dev"
},

"mounts": [
"source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind"
]
}
42 changes: 42 additions & 0 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
services:
app:
build:
context: ..
dockerfile: .devcontainer/Dockerfile
volumes:
- ..:/workspaces/mofe-api:cached
command: sleep infinity
network_mode: service:db
depends_on:
- db
- rabbitmq

db:
image: 'mariadb:latest'
restart: unless-stopped
environment:
- 'MARIADB_DATABASE=cafecoder_back_rails_development'
- 'MARIADB_PASSWORD=password'
- 'MARIADB_ROOT_PASSWORD=password'
- 'MARIADB_USER=root'
ports:
- '3306:3306'
volumes:
- mariadb-data:/var/lib/mysql
- ./dump.sql:/docker-entrypoint-initdb.d/dump.sql

rabbitmq:
image: 'rabbitmq:3-management'
restart: unless-stopped
environment:
- 'RABBITMQ_DEFAULT_PASS=secret'
- 'RABBITMQ_DEFAULT_USER=myuser'
ports:
- '5672:5672'
- '15672:15672'
volumes:
- rabbitmq-data:/var/lib/rabbitmq

volumes:
mariadb-data:
rabbitmq-data:
Loading