Skip to content

Commit

Permalink
Tie to the custom docker network for the devcontainers (#1986)
Browse files Browse the repository at this point in the history
* Reworked vscode extensions

* Readded a docker-compose based config for the vscode devcontainer.

* Fixing issues with docker compose and file setup

* Fixing a bit more minor issues from docker compose switch

* Tying admin to custom docker network

* Removing old docker compose file

* Removing old commented code
  • Loading branch information
jimleroyer authored Nov 4, 2024
1 parent a1b800f commit 26374b8
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 40 deletions.
4 changes: 3 additions & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ RUN apt-get update \
exa \
fd-find \
git \
iputils-ping \
iproute2 \
less \
libsodium-dev \
Expand Down Expand Up @@ -51,7 +52,8 @@ RUN apt-get update \
# Upgrade pip
RUN pip install --upgrade pip

COPY .devcontainer/scripts/notify-dev-entrypoint.sh /usr/local/bin/
COPY --chown=vscode:vscode .devcontainer/scripts/notify-dev-entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/notify-dev-entrypoint.sh

COPY --chown=vscode:vscode .devcontainer/scripts/installations.sh /usr/local/bin/
RUN chmod -R 765 /usr/local/bin/installations.sh
Expand Down
33 changes: 17 additions & 16 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,31 +1,36 @@
{
"name": "notification-admin",
"build": {
"dockerfile": "Dockerfile",
"context": ".."
},
"dockerComposeFile": "docker-compose.yml",
"service": "notify-admin",
"workspaceFolder": "/workspace",
"shutdownAction": "stopCompose",
"remoteEnv": {
"PATH": "/home/vscode/.local/bin:${containerEnv:PATH}" // give our installed Python modules precedence
},
"containerEnv": {
"SHELL": "/bin/zsh"
},
"customizations":{
"customizations": {
"vscode": {
"extensions": [
"njpwerner.autodocstring",
"-ms-python.autopep8",
"charliermarsh.ruff",
"donjayamanne.python-extension-pack",
"eamodio.gitlens",
"fill-labs.dependi",
"github.copilot",
"GitHub.copilot-labs",
"donjayamanne.python-extension-pack",
"-ms-python.autopep8",
"mechatroner.rainbow-csv",
"ms-azuretools.vscode-docker",
"ms-ossdata.vscode-postgresql",
"ms-python.black-formatter",
"ms-python.vscode-pylance",
"eamodio.gitlens",
"njpwerner.autodocstring",
"wholroyd.jinja",
"visualstudioexptteam.vscodeintellicode",
"yzhang.markdown-all-in-one",
"ms-ossdata.vscode-postgresql",
"tamasfe.even-better-toml",
"charliermarsh.ruff",
"vsliveshare.vsliveshare"
],
"settings": {
"ruff.lint.run": "onSave",
Expand All @@ -38,15 +43,11 @@
}
}
},

"features": {
"ghcr.io/devcontainers/features/node:1": {
"version": "16.20.0"
}
},
"forwardPorts": [
6012
],
"postCreateCommand": "notify-dev-entrypoint.sh",
"postCreateCommand": "/usr/local/bin/notify-dev-entrypoint.sh",
"remoteUser": "vscode"
}
32 changes: 32 additions & 0 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
version: '3'
services:
# Update this to the name of the service you want to work with in your docker-compose.yml file
notify-admin:
build:
context: ..
dockerfile: .devcontainer/Dockerfile
# If you want add a non-root user to your Dockerfile, you can use the "remoteUser"
# property in devcontainer.json to cause VS Code its sub-processes (terminals, tasks,
# debugging) to execute as the user. Uncomment the next line if you want the entire
# container to run as this user instead. Note that, on Linux, you may need to
# ensure the UID and GID of the container user you create matches your local user.
# See https://aka.ms/vscode-remote/containers/non-root for details.
user: vscode

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

# Uncomment the next line to use Docker from inside the container. See https://aka.ms/vscode-remote/samples/docker-from-docker-compose for details.
# - /var/run/docker.sock:/var/run/docker.sock

# Overrides default command so things don't shut down after the process ends.
command: sleep infinity
expose:
- "6012"
networks:
- notify-network

networks:
notify-network:
external: true
4 changes: 2 additions & 2 deletions .devcontainer/scripts/installations.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ which poetry
poetry --version

# Initialize poetry autocompletions
mkdir ~/.zfunc
mkdir -p ~/.zfunc
touch ~/.zfunc/_poetry
poetry completions zsh > ~/.zfunc/_poetry

# Install dependencies
cd /workspaces/notification-admin
cd /workspace
poetry install

# Poe the Poet plugin tab completions
Expand Down
4 changes: 2 additions & 2 deletions .devcontainer/scripts/notify-dev-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ set -ex
# Tell git the workspace repository is safe, else upcoming commands will fail.
git config --global --add safe.directory /workspaces/notification-admin

chown -R vscode:vscode /workspaces/notification-admin
sudo -u vscode -i -- /usr/local/bin/installations.sh
# Install and setup dev environment
installations.sh
19 changes: 0 additions & 19 deletions docker-compose.yml

This file was deleted.

0 comments on commit 26374b8

Please sign in to comment.