From d443f861d6644627cf2f4528c0715b7752bc92c2 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Mon, 28 Oct 2024 08:48:11 -0300 Subject: [PATCH 1/4] Add Dockerfile for devcontainer with Rust and UV setup --- .devcontainer/Dockerfile | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .devcontainer/Dockerfile diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 000000000000..352c2766ae16 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,29 @@ +# Source: https://github.com/a5chin/python-uv +FROM debian:bookworm-slim AS builder + +ENV CARGO_HOME="/opt/.cargo" + +SHELL [ "/bin/bash", "-o", "pipefail", "-c" ] + +WORKDIR /opt + +# The installer requires curl (and certificates) to download the release archive +# hadolint ignore=DL3008 +RUN apt-get update && \ + apt-get install -y --no-install-recommends ca-certificates curl + +# Run uv installer +RUN curl -LsSf https://astral.sh/uv/install.sh | sh + + +FROM mcr.microsoft.com/vscode/devcontainers/base:bookworm + + +ENV CARGO_HOME="/opt/.cargo" +ENV PATH="$CARGO_HOME/bin/:$PATH" +ENV PYTHONUNBUFFERED=True +ENV UV_LINK_MODE=copy + +WORKDIR /opt + +COPY --from=builder --chown=vscode: $CARGO_HOME $CARGO_HOME \ No newline at end of file From 43c5a63e08cc3e1b48d9e67d1b7a1b8dfaa968e0 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Mon, 28 Oct 2024 08:48:19 -0300 Subject: [PATCH 2/4] Update devcontainer configuration to use Dockerfile and enhance features - Switch from using a pre-built image to building from a Dockerfile. - Replace Poetry feature with Hadolint for linting Dockerfiles. - Add new VSCode extensions: Ruff, Autodocstring, Indent Rainbow, and Hadolint. - Set default terminal profile to zsh in VSCode settings. - Add a postStartCommand to initialize the environment. - Change remote user to 'vscode'. --- .devcontainer/devcontainer.json | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 4df8df96b0f2..88c16501327c 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -2,13 +2,14 @@ // README at: https://github.com/devcontainers/templates/tree/main/src/universal { "name": "Langflow Dev Container", - // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile - "image": "mcr.microsoft.com/devcontainers/python:3.10", - + "build": { + "context": "..", + "dockerfile": "Dockerfile" + }, // Features to add to the dev container. More info: https://containers.dev/features. "features": { "ghcr.io/devcontainers/features/node": {}, - "ghcr.io/devcontainers-contrib/features/poetry": {} + "ghcr.io/dhoeric/features/hadolint:1": {} }, // Use 'forwardPorts' to make a list of ports inside the container available locally. @@ -16,26 +17,35 @@ // Use 'postCreateCommand' to run commands after the container is created. "postCreateCommand": "make install_frontend && make install_backend", - - "containerEnv": { - "POETRY_VIRTUALENVS_IN_PROJECT": "true" - }, + "postStartCommand": "make init", // Configure tool-specific properties. "customizations": { "vscode": { "extensions": [ + "charliermarsh.ruff", + "njpwerner.autodocstring", + "oderwat.indent-rainbow", + "exiasr.hadolint", "actboy168.tasks", "GitHub.copilot", "ms-python.python", - "sourcery.sourcery", "eamodio.gitlens", "ms-vscode.makefile-tools", "GitHub.vscode-pull-request-github" - ] + ], + "settings": { + "terminal.integrated.defaultProfile.linux": "zsh", + "terminal.integrated.profiles.linux": { + "zsh": { + "path": "/bin/zsh" + } + } + } } - } + }, // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. // "remoteUser": "root" + "remoteUser": "vscode" } From 20ffe72ec1c7e0bba4ef27f900c224130cc086d1 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Mon, 28 Oct 2024 08:55:12 -0300 Subject: [PATCH 3/4] Update test command in VSCode tasks to 'make unit_tests' --- .vscode/tasks.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 25b480b27a28..929271b29991 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -24,7 +24,7 @@ { "label": "Test", "type": "shell", - "command": "make tests" + "command": "make unit_tests" }, // make lint { From 8faf4ff6a868df5190f614df8567d03074314ab3 Mon Sep 17 00:00:00 2001 From: italojohnny Date: Mon, 28 Oct 2024 14:56:54 -0300 Subject: [PATCH 4/4] chore: remove unnecessary comment --- docker/dev.docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/dev.docker-compose.yml b/docker/dev.docker-compose.yml index 31b6505c9e4a..5cad3f5d2a9d 100644 --- a/docker/dev.docker-compose.yml +++ b/docker/dev.docker-compose.yml @@ -23,7 +23,7 @@ services: volumes: - ../:/app depends_on: - - postgres # DependĂȘncia no seu banco de dados existente + - postgres networks: - dev-langflow