Skip to content

Commit

Permalink
chore: update devcontainer configuration and Dockerfile (langflow-ai#…
Browse files Browse the repository at this point in the history
…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 <[email protected]>
  • Loading branch information
ogabrielluiz and italojohnny authored Oct 30, 2024
1 parent 6c3c328 commit 0fd3d93
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 15 deletions.
29 changes: 29 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
33 changes: 20 additions & 13 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,43 +2,50 @@
// 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.
// "forwardPorts": [],

// 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 changes: 1 addition & 1 deletion .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
{
"label": "Test",
"type": "shell",
"command": "make tests"
"command": "make unit_tests"
},
// make lint
{
Expand Down
2 changes: 1 addition & 1 deletion docker/dev.docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ services:
volumes:
- ../:/app
depends_on:
- postgres # Dependência no seu banco de dados existente
- postgres
networks:
- dev-langflow

Expand Down

0 comments on commit 0fd3d93

Please sign in to comment.