This commit is contained in:
parent
b8cfb5c020
commit
77f0b07538
10 changed files with 299 additions and 1 deletions
|
@ -14,7 +14,7 @@ It should work as a good starting point for your devcontainer configuration.
|
|||
|
||||
## Usage
|
||||
|
||||
In your repositories `.devcontainer` directory, add a `Dockerfile` which builds upon this container.
|
||||
There are example `.devcontainer` directories in the `examples` directory.
|
||||
|
||||
## License
|
||||
|
||||
|
|
23
examples/elixir-postgres/Dockerfile
Normal file
23
examples/elixir-postgres/Dockerfile
Normal file
|
@ -0,0 +1,23 @@
|
|||
FROM code.harton.nz/james/dev-container/elixir:latest
|
||||
|
||||
ARG USERNAME=vscode
|
||||
USER ${USERNAME}
|
||||
ENV HOME=/home/${USERNAME}
|
||||
|
||||
COPY .tool-versions /workspace/
|
||||
|
||||
WORKDIR /workspace/
|
||||
|
||||
RUN asdf_install
|
||||
|
||||
ARG HEX_API_KEY
|
||||
RUN asdf mix local.rebar --force
|
||||
RUN asdf mix local.hex --force
|
||||
|
||||
ENV ERL_AFLAGS="-kernel shell_history enabled -kernel shell_history_path '\"/var/tmp/history/erlang.history\"'"
|
||||
|
||||
COPY .env* mix.* /workspace/
|
||||
|
||||
RUN /bin/bash -c 'if [ -e .envrc ]; then /usr/bin/direnv allow; fi'
|
||||
|
||||
RUN asdf mix deps.get
|
37
examples/elixir-postgres/devcontainer.json
Normal file
37
examples/elixir-postgres/devcontainer.json
Normal file
|
@ -0,0 +1,37 @@
|
|||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
|
||||
// https://github.com/microsoft/vscode-dev-containers/tree/v0.241.1/containers/elixir-phoenix-postgres
|
||||
{
|
||||
"name": "ASDF and Elixir",
|
||||
"workspaceFolder": "/workspace",
|
||||
"dockerComposeFile": "docker-compose.yml",
|
||||
"service": "app",
|
||||
// Configure tool-specific properties.
|
||||
"customizations": {
|
||||
// Configure properties specific to VS Code.
|
||||
"vscode": {
|
||||
// Add the IDs of extensions you want installed when the container is created.
|
||||
"extensions": [
|
||||
"jakebecker.elixir-ls",
|
||||
"ue.alphabetical-sorter",
|
||||
"wmaurer.change-case",
|
||||
"Rubymaniac.vscode-direnv",
|
||||
"RoyalMist.vscode-eex-format",
|
||||
"iampeterbanjo.elixirlinter",
|
||||
"pgourlain.erlang",
|
||||
"szTheory.erlang-formatter",
|
||||
"esbenp.prettier-vscode"
|
||||
]
|
||||
}
|
||||
},
|
||||
// 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": [
|
||||
4000,
|
||||
4001,
|
||||
5432
|
||||
],
|
||||
// Use 'postCreateCommand' to run commands after the container is created.
|
||||
// "postCreateCommand": "mix deps.get"
|
||||
// Uncomment to connect as a non-root user. See https://aka.ms/vscode-remote/containers/non-root.
|
||||
"remoteUser": "vscode"
|
||||
}
|
56
examples/elixir-postgres/docker-compose.yml
Normal file
56
examples/elixir-postgres/docker-compose.yml
Normal file
|
@ -0,0 +1,56 @@
|
|||
version: "3.8"
|
||||
|
||||
volumes:
|
||||
apt-cache: {}
|
||||
history: {}
|
||||
db-data: {}
|
||||
app-deps: {}
|
||||
app-build: {}
|
||||
app-elixir-ls: {}
|
||||
app-asdf: {}
|
||||
app-storage: {}
|
||||
|
||||
services:
|
||||
app:
|
||||
environment:
|
||||
LOGGER_LEVEL: 1
|
||||
PGHOST: db
|
||||
PGPORT: 5432
|
||||
PGUSER: postgres
|
||||
PGDATABASE: app
|
||||
HISTFILE: /var/tmp/history/shell.history
|
||||
GIT_AUTHOR_EMAIL:
|
||||
GIT_COMMITTER_EMAIL:
|
||||
GITHUB_TOKEN:
|
||||
PORT: 400
|
||||
build:
|
||||
context: ../
|
||||
dockerfile: .devcontainer/Dockerfile
|
||||
args:
|
||||
HEX_API_KEY:
|
||||
GITHUB_TOKEN:
|
||||
|
||||
volumes:
|
||||
- ..:/workspace:cached
|
||||
- "apt-cache:/var/cache/apt:rw"
|
||||
- "history:/var/tmp/history:rw"
|
||||
- "app-asdf:/home/vscode/.asdf:rw"
|
||||
- "app-deps:/workspace/deps:rw"
|
||||
- "app-build:/workspace/_build:rw"
|
||||
- "app-elixir-ls:/workspace/.elixir_ls:rw"
|
||||
- "app-storage:/storage:rw"
|
||||
# Runs app on the same network as the database container, allows "forwardPorts" in devcontainer.json function.
|
||||
network_mode: service:db
|
||||
|
||||
# Overrides default command so things don't shut down after the process ends.
|
||||
command: sleep infinity
|
||||
|
||||
db:
|
||||
image: postgres:latest
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- db-data:/var/lib/postgresql/data
|
||||
environment:
|
||||
POSTGRES_HOST_AUTH_METHOD: trust
|
||||
ports:
|
||||
- 5432:5432
|
23
examples/elixir/Dockerfile
Normal file
23
examples/elixir/Dockerfile
Normal file
|
@ -0,0 +1,23 @@
|
|||
FROM code.harton.nz/james/dev-container/elixir:latest
|
||||
|
||||
ARG USERNAME=vscode
|
||||
USER ${USERNAME}
|
||||
ENV HOME=/home/${USERNAME}
|
||||
|
||||
COPY .tool-versions /workspace/
|
||||
|
||||
WORKDIR /workspace/
|
||||
|
||||
RUN asdf_install
|
||||
|
||||
ARG HEX_API_KEY
|
||||
RUN asdf mix local.rebar --force
|
||||
RUN asdf mix local.hex --force
|
||||
|
||||
ENV ERL_AFLAGS="-kernel shell_history enabled -kernel shell_history_path '\"/var/tmp/history/erlang.history\"'"
|
||||
|
||||
COPY .env* mix.* /workspace/
|
||||
|
||||
RUN /bin/bash -c 'if [ -e .envrc ]; then /usr/bin/direnv allow; fi'
|
||||
|
||||
RUN asdf mix deps.get
|
37
examples/elixir/devcontainer.json
Normal file
37
examples/elixir/devcontainer.json
Normal file
|
@ -0,0 +1,37 @@
|
|||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
|
||||
// https://github.com/microsoft/vscode-dev-containers/tree/v0.241.1/containers/elixir-phoenix-postgres
|
||||
{
|
||||
"name": "ASDF and Elixir",
|
||||
"workspaceFolder": "/workspace",
|
||||
"dockerComposeFile": "docker-compose.yml",
|
||||
"service": "app",
|
||||
// Configure tool-specific properties.
|
||||
"customizations": {
|
||||
// Configure properties specific to VS Code.
|
||||
"vscode": {
|
||||
// Add the IDs of extensions you want installed when the container is created.
|
||||
"extensions": [
|
||||
"jakebecker.elixir-ls",
|
||||
"ue.alphabetical-sorter",
|
||||
"wmaurer.change-case",
|
||||
"Rubymaniac.vscode-direnv",
|
||||
"RoyalMist.vscode-eex-format",
|
||||
"iampeterbanjo.elixirlinter",
|
||||
"pgourlain.erlang",
|
||||
"szTheory.erlang-formatter",
|
||||
"esbenp.prettier-vscode"
|
||||
]
|
||||
}
|
||||
},
|
||||
// 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": [
|
||||
4000,
|
||||
4001,
|
||||
5432
|
||||
],
|
||||
// Use 'postCreateCommand' to run commands after the container is created.
|
||||
// "postCreateCommand": "mix deps.get"
|
||||
// Uncomment to connect as a non-root user. See https://aka.ms/vscode-remote/containers/non-root.
|
||||
"remoteUser": "vscode"
|
||||
}
|
39
examples/elixir/docker-compose.yml
Normal file
39
examples/elixir/docker-compose.yml
Normal file
|
@ -0,0 +1,39 @@
|
|||
version: "3.8"
|
||||
|
||||
volumes:
|
||||
apt-cache: {}
|
||||
history: {}
|
||||
app-deps: {}
|
||||
app-build: {}
|
||||
app-elixir-ls: {}
|
||||
app-asdf: {}
|
||||
app-storage: {}
|
||||
|
||||
services:
|
||||
app:
|
||||
environment:
|
||||
LOGGER_LEVEL: 1
|
||||
HISTFILE: /var/tmp/history/shell.history
|
||||
GIT_AUTHOR_EMAIL:
|
||||
GIT_COMMITTER_EMAIL:
|
||||
GITHUB_TOKEN:
|
||||
PORT: 400
|
||||
build:
|
||||
context: ../
|
||||
dockerfile: .devcontainer/Dockerfile
|
||||
args:
|
||||
HEX_API_KEY:
|
||||
GITHUB_TOKEN:
|
||||
|
||||
volumes:
|
||||
- ..:/workspace:cached
|
||||
- "apt-cache:/var/cache/apt:rw"
|
||||
- "history:/var/tmp/history:rw"
|
||||
- "app-asdf:/home/vscode/.asdf:rw"
|
||||
- "app-deps:/workspace/deps:rw"
|
||||
- "app-build:/workspace/_build:rw"
|
||||
- "app-elixir-ls:/workspace/.elixir_ls:rw"
|
||||
- "app-storage:/storage:rw"
|
||||
|
||||
# Overrides default command so things don't shut down after the process ends.
|
||||
command: sleep infinity
|
21
examples/rust/Dockerfile
Normal file
21
examples/rust/Dockerfile
Normal file
|
@ -0,0 +1,21 @@
|
|||
FROM code.harton.nz/james/dev-container/rust:latest
|
||||
|
||||
ARG USERNAME=vscode
|
||||
USER ${USERNAME}
|
||||
ENV HOME=/home/${USERNAME}
|
||||
|
||||
COPY .tool-versions /workspace
|
||||
|
||||
WORKDIR /workspace
|
||||
|
||||
RUN asdf_install
|
||||
|
||||
# Prodigious use of asterisk to allow for files which may not exist.
|
||||
COPY .env* Cargo.toml Cargo.lock /workspace/
|
||||
|
||||
RUN /bin/bash -c 'if [ -e .envrc ]; then /usr/bin/direnv allow; fi'
|
||||
|
||||
RUN asdf cargo fetch
|
||||
|
||||
CMD ["zsh"]
|
||||
|
33
examples/rust/devcontainer.json
Normal file
33
examples/rust/devcontainer.json
Normal file
|
@ -0,0 +1,33 @@
|
|||
// For format details, see https://aka.ms/devcontainer.json.
|
||||
{
|
||||
"name": "ASDF/Rust",
|
||||
"workspaceFolder": "/workspace",
|
||||
"dockerComposeFile": "docker-compose.yml",
|
||||
"service": "dev",
|
||||
"customizations": {
|
||||
"vscode": {
|
||||
"settings": {
|
||||
"lldb.executable": "/usr/bin/lldb",
|
||||
// VS Code don't watch files under ./target
|
||||
"files.watcherExclude": {
|
||||
"**/target/**": true
|
||||
},
|
||||
"rust-analyzer.checkOnSave.command": "clippy"
|
||||
},
|
||||
"extensions": [
|
||||
"canna.figlet",
|
||||
"marclipovsky.string-manipulation",
|
||||
"mutantdino.resourcemonitor",
|
||||
"RobbOwen.synthwave-vscode",
|
||||
"Rubymaniac.vscode-direnv",
|
||||
"rust-lang.rust-analyzer",
|
||||
"serayuzgur.crates",
|
||||
"tamasfe.even-better-toml",
|
||||
"ue.alphabetical-sorter",
|
||||
"vadimcn.vscode-lldb",
|
||||
"wmaurer.change-case"
|
||||
]
|
||||
}
|
||||
},
|
||||
"remoteUser": "vscode"
|
||||
}
|
29
examples/rust/docker-compose.yml
Normal file
29
examples/rust/docker-compose.yml
Normal file
|
@ -0,0 +1,29 @@
|
|||
version: "3.2"
|
||||
|
||||
volumes:
|
||||
apt-cache: {}
|
||||
history: {}
|
||||
asdf: {}
|
||||
target: {}
|
||||
|
||||
services:
|
||||
dev:
|
||||
environment:
|
||||
GIT_COMMITER_EMAIL:
|
||||
GIT_AUTHOR_EMAIL:
|
||||
build:
|
||||
context: ../
|
||||
dockerfile: .devcontainer/Dockerfile
|
||||
labels:
|
||||
- "org.opencontainers.image.source=https://gitlab.com/jimsy/outrun"
|
||||
volumes:
|
||||
- ..:/workspace:cached
|
||||
- "apt-cache:/var/cache/apt:rw"
|
||||
- "history:/var/tmp/history:rw"
|
||||
- "asdf:/users/vscode/.asdf:rw"
|
||||
- "target:/users/vscode/target:rw"
|
||||
cap_add:
|
||||
- SYS_PTRACE
|
||||
security_opt:
|
||||
- seccomp:unconfined
|
||||
command: sleep infinity
|
Loading…
Reference in a new issue