Skip to content

Commit d0b5261

Browse files
author
May Meow
committed
add dev container for vscode
1 parent f6a7e05 commit d0b5261

File tree

3 files changed

+84
-0
lines changed

3 files changed

+84
-0
lines changed

.devcontainer/devcontainer.json

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
2+
// https://github.com/microsoft/vscode-dev-containers/tree/v0.202.5/containers/docker-existing-docker-compose
3+
// If you want to run as a non-root user in the container, see .devcontainer/docker-compose.yml.
4+
{
5+
"name": "Existing Docker Compose (Extend)",
6+
7+
// Update the 'dockerComposeFile' list if you have more compose files or use different names.
8+
// The .devcontainer/docker-compose.yml file contains any overrides you need/want to make.
9+
"dockerComposeFile": [
10+
"../docker-compose-dev.yml",
11+
"docker-compose.yml"
12+
],
13+
14+
// The 'service' property is the name of the service for the container that VS Code should
15+
// use. Update this value and .devcontainer/docker-compose.yml to the real service name.
16+
"service": "app",
17+
18+
// The optional 'workspaceFolder' property is the path VS Code should open by default when
19+
// connected. This is typically a file mount in .devcontainer/docker-compose.yml
20+
"workspaceFolder": "/workspace",
21+
22+
// Set *default* container specific settings.json values on container create.
23+
"settings": {},
24+
25+
// Add the IDs of extensions you want installed when the container is created.
26+
"extensions": []
27+
28+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
29+
// "forwardPorts": [],
30+
31+
// Uncomment the next line if you want start specific services in your Docker Compose config.
32+
// "runServices": [],
33+
34+
// Uncomment the next line if you want to keep your containers running after VS Code shuts down.
35+
// "shutdownAction": "none",
36+
37+
// Uncomment the next line to run commands after the container is created - for example installing curl.
38+
// "postCreateCommand": "apt-get update && apt-get install -y curl",
39+
40+
// Uncomment to connect as a non-root user if you've added one. See https://aka.ms/vscode-remote/containers/non-root.
41+
// "remoteUser": "vscode"
42+
}

.devcontainer/docker-compose.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
version: '3'
2+
services:
3+
# Update this to the name of the service you want to work with in your docker-compose.yml file
4+
app:
5+
# If you want add a non-root user to your Dockerfile, you can use the "remoteUser"
6+
# property in devcontainer.json to cause VS Code its sub-processes (terminals, tasks,
7+
# debugging) to execute as the user. Uncomment the next line if you want the entire
8+
# container to run as this user instead. Note that, on Linux, you may need to
9+
# ensure the UID and GID of the container user you create matches your local user.
10+
# See https://aka.ms/vscode-remote/containers/non-root for details.
11+
#
12+
# user: vscode
13+
14+
# Uncomment if you want to override the service's Dockerfile to one in the .devcontainer
15+
# folder. Note that the path of the Dockerfile and context is relative to the *primary*
16+
# docker-compose.yml file (the first in the devcontainer.json "dockerComposeFile"
17+
# array). The sample below assumes your primary file is in the root of your project.
18+
#
19+
# build:
20+
# context: .
21+
# dockerfile: .devcontainer/Dockerfile
22+
23+
init: true
24+
25+
volumes:
26+
# Update this to wherever you want VS Code to mount the folder of your project
27+
- .:/workspace:cached
28+
29+
# Uncomment the next line to use Docker from inside the container. See https://aka.ms/vscode-remote/samples/docker-from-docker-compose for details.
30+
# - /var/run/docker.sock:/var/run/docker.sock
31+
32+
# Uncomment the next four lines if you will use a ptrace-based debugger like C++, Go, and Rust.
33+
# cap_add:
34+
# - SYS_PTRACE
35+
# security_opt:
36+
# - seccomp:unconfined
37+
38+
# Overrides default command so things don't shut down after the process ends.
39+
command: /bin/bash -c "while sleep 1000; do :; done"
40+

docker/devcontainer/Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
FROM ghcr.io/maymeow/php-ci-cd/php-ci-cd:7.4.16-cs-1
22

3+
# RUN apt update && apt install -y git
4+
35
# arguments in docker-compose file
46
ARG user=vscode
57
ARG uid=1000

0 commit comments

Comments
 (0)