chore: update devcontainer configuration and Dockerfile (#4298)

* Add Dockerfile for devcontainer with Rust and UV setup

* 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'.

* Update test command in VSCode tasks to 'make unit_tests'

* chore: remove unnecessary comment

---------

Co-authored-by: italojohnny <italojohnnydosanjos@gmail.com>
This commit is contained in:
Gabriel Luiz Freitas Almeida 2024-10-30 08:11:16 -03:00 committed by GitHub
commit 0fd3d93b1d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 51 additions and 15 deletions

29
.devcontainer/Dockerfile Normal file
View file

@ -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

View file

@ -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,29 +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"
}
}
}
}
},
"tasks": {
"test": "make unit_tests"
}
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
"remoteUser": "vscode"
}

2
.vscode/tasks.json vendored
View file

@ -24,7 +24,7 @@
{
"label": "Test",
"type": "shell",
"command": "make tests"
"command": "make unit_tests"
},
// make lint
{

View file

@ -23,7 +23,7 @@ services:
volumes:
- ../:/app
depends_on:
- postgres # Dependência no seu banco de dados existente
- postgres
networks:
- dev-langflow