refactor: Add Docker and Docker Compose installation to devcontainer setup

This commit is contained in:
Danny Avila 2024-06-30 17:16:47 -04:00
parent 87bdbda10a
commit 104dc9a08e
No known key found for this signature in database
GPG key ID: 2DD9CC89B9B50364
3 changed files with 23 additions and 8 deletions

View file

@ -1,5 +1,16 @@
FROM node:18-bullseye FROM node:18-bullseye
RUN useradd -m -s /bin/bash vscode RUN apt-get update && apt-get install -y sudo
RUN useradd -m -s /bin/bash vscode && echo "vscode ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/vscode
RUN mkdir -p /workspaces && chown -R vscode:vscode /workspaces RUN mkdir -p /workspaces && chown -R vscode:vscode /workspaces
WORKDIR /workspaces WORKDIR /workspaces
# Install Docker and Docker Compose
RUN apt-get update && \
apt-get install -y apt-transport-https ca-certificates curl gnupg lsb-release && \
curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg && \
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.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 docker-ce-cli containerd.io docker-compose-plugin
USER vscode

View file

@ -1,18 +1,21 @@
{ {
"name": "LibreChat Development",
"dockerComposeFile": "docker-compose.yml", "dockerComposeFile": "docker-compose.yml",
"service": "app", "service": "app",
"workspaceFolder": "/workspaces", "workspaceFolder": "/workspaces",
"customizations": { "customizations": {
"vscode": { "vscode": {
"extensions": [], "extensions": ["ms-azuretools.vscode-docker"],
"settings": { "settings": {
"terminal.integrated.profiles.linux": { "terminal.integrated.defaultProfile.linux": "bash"
"bash": null
}
} }
} }
}, },
"postCreateCommand": "", "postCreateCommand": "sudo apt-get update && sudo apt-get install -y docker.io docker-compose",
"features": { "ghcr.io/devcontainers/features/git:1": {} }, "features": {
"remoteUser": "vscode" "ghcr.io/devcontainers/features/git:1": {},
"ghcr.io/devcontainers/features/docker-in-docker:2": {}
},
"remoteUser": "vscode",
"forwardPorts": [3080, 27017, 7700]
} }

View file

@ -17,6 +17,7 @@ services:
volumes: volumes:
# This is where VS Code should expect to find your project's source code and the value of "workspaceFolder" in .devcontainer/devcontainer.json # This is where VS Code should expect to find your project's source code and the value of "workspaceFolder" in .devcontainer/devcontainer.json
- ..:/workspaces:cached - ..:/workspaces:cached
- /var/run/docker.sock:/var/run/docker.sock
# Uncomment the next line to use Docker from inside the container. See https://aka.ms/vscode-remote/samples/docker-from-docker-compose for details. # 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 # - /var/run/docker.sock:/var/run/docker.sock
environment: environment: