mirror of
https://github.com/langgenius/dify.git
synced 2024-11-16 11:42:29 +08:00
Add trobleshooting notes for devcontainer (#687)
This commit is contained in:
parent
12ecf89a87
commit
1647970fb6
11
.devcontainer/Dockerfile
Normal file
11
.devcontainer/Dockerfile
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
FROM mcr.microsoft.com/devcontainers/anaconda:0-3
|
||||||
|
|
||||||
|
# Copy environment.yml (if found) to a temp location so we update the environment. Also
|
||||||
|
# copy "noop.txt" so the COPY instruction does not fail if no environment.yml exists.
|
||||||
|
COPY environment.yml* .devcontainer/noop.txt /tmp/conda-tmp/
|
||||||
|
RUN if [ -f "/tmp/conda-tmp/environment.yml" ]; then umask 0002 && /opt/conda/bin/conda env update -n base -f /tmp/conda-tmp/environment.yml; fi \
|
||||||
|
&& rm -rf /tmp/conda-tmp
|
||||||
|
|
||||||
|
# [Optional] Uncomment this section to install additional OS packages.
|
||||||
|
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
|
||||||
|
# && apt-get -y install --no-install-recommends <your-package-list-here>
|
37
.devcontainer/README.md
Normal file
37
.devcontainer/README.md
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
# Devlopment with devcontainer
|
||||||
|
This project includes a devcontainer configuration that allows you to open the project in a container with a fully configured development environment.
|
||||||
|
Both frontend and backend environments are initialized when the container is started.
|
||||||
|
## GitHub Codespaces
|
||||||
|
[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/langgenius/dify)
|
||||||
|
|
||||||
|
you can simply click the button above to open this project in GitHub Codespaces.
|
||||||
|
|
||||||
|
For more info, check out the [GitHub documentation](https://docs.github.com/en/free-pro-team@latest/github/developing-online-with-codespaces/creating-a-codespace#creating-a-codespace).
|
||||||
|
|
||||||
|
|
||||||
|
## VS Code Dev Containers
|
||||||
|
[![Open in Dev Containers](https://img.shields.io/static/v1?label=Dev%20Containers&message=Open&color=blue&logo=visualstudiocode)](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/langgenius/dify)
|
||||||
|
|
||||||
|
if you have VS Code installed, you can click the button above to open this project in VS Code Dev Containers.
|
||||||
|
|
||||||
|
You can learn more in the [Dev Containers documentation](https://code.visualstudio.com/docs/devcontainers/containers).
|
||||||
|
|
||||||
|
|
||||||
|
## Pros of Devcontainer
|
||||||
|
Unified Development Environment: By using devcontainers, you can ensure that all developers are developing in the same environment, reducing the occurrence of "it works on my machine" type of issues.
|
||||||
|
|
||||||
|
Quick Start: New developers can set up their development environment in a few simple steps, without spending a lot of time on environment configuration.
|
||||||
|
|
||||||
|
Isolation: Devcontainers isolate your project from your host operating system, reducing the chance of OS updates or other application installations impacting the development environment.
|
||||||
|
|
||||||
|
## Cons of Devcontainer
|
||||||
|
Learning Curve: For developers unfamiliar with Docker and VS Code, using devcontainers may be somewhat complex.
|
||||||
|
|
||||||
|
Performance Impact: While usually minimal, programs running inside a devcontainer may be slightly slower than those running directly on the host.
|
||||||
|
|
||||||
|
## Troubleshooting
|
||||||
|
if you see such error message when you open this project in codespaces:
|
||||||
|
![Alt text](troubleshooting.png)
|
||||||
|
|
||||||
|
a simple workaround is change `/signin` endpoint into another one, then login with github account and close the tab, then change it back to `/signin` endpoint. Then all things will be fine.
|
||||||
|
The reason is `signin` endpoint is not allowed in codespaces, details can be found [here](https://github.com/orgs/community/discussions/5204)
|
53
.devcontainer/devcontainer.json
Normal file
53
.devcontainer/devcontainer.json
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
|
||||||
|
// README at: https://github.com/devcontainers/templates/tree/main/src/anaconda
|
||||||
|
{
|
||||||
|
"name": "Anaconda (Python 3)",
|
||||||
|
"build": {
|
||||||
|
"context": "..",
|
||||||
|
"dockerfile": "Dockerfile"
|
||||||
|
},
|
||||||
|
"features": {
|
||||||
|
"ghcr.io/dhoeric/features/act:1": {},
|
||||||
|
"ghcr.io/devcontainers/features/node:1": {
|
||||||
|
"nodeGypDependencies": true,
|
||||||
|
"version": "lts"
|
||||||
|
},
|
||||||
|
"ghcr.io/devcontainers-contrib/features/npm-package:1": {
|
||||||
|
"package": "typescript",
|
||||||
|
"version": "latest"
|
||||||
|
},
|
||||||
|
"ghcr.io/devcontainers/features/docker-in-docker:2": {
|
||||||
|
"moby": true,
|
||||||
|
"azureDnsAutoDetection": true,
|
||||||
|
"installDockerBuildx": true,
|
||||||
|
"version": "latest",
|
||||||
|
"dockerDashComposeVersion": "v2"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"customizations": {
|
||||||
|
"vscode": {
|
||||||
|
"extensions": [
|
||||||
|
"ms-python.pylint",
|
||||||
|
"GitHub.copilot",
|
||||||
|
"ms-python.python"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"postStartCommand": "cd api && pip install -r requirements.txt",
|
||||||
|
"postCreateCommand": "cd web && npm install"
|
||||||
|
|
||||||
|
// Features to add to the dev container. More info: https://containers.dev/features.
|
||||||
|
// "features": {},
|
||||||
|
|
||||||
|
// 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": "python --version",
|
||||||
|
|
||||||
|
// Configure tool-specific properties.
|
||||||
|
// "customizations": {},
|
||||||
|
|
||||||
|
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
|
||||||
|
// "remoteUser": "root"
|
||||||
|
}
|
3
.devcontainer/noop.txt
Normal file
3
.devcontainer/noop.txt
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
This file copied into the container along with environment.yml* from the parent
|
||||||
|
folder. This file is included to prevents the Dockerfile COPY instruction from
|
||||||
|
failing if no environment.yml is found.
|
BIN
.devcontainer/troubleshooting.png
Normal file
BIN
.devcontainer/troubleshooting.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 14 KiB |
Loading…
Reference in New Issue
Block a user