-
Notifications
You must be signed in to change notification settings - Fork 391
feat: add .NET #2571
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add .NET #2571
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| additionalProperties: |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| services: | ||
| java: | ||
| image: mcr.microsoft.com/dotnet/aspnet:${DOTNET_VERSION} | ||
| container_name: ${CONTAINER_NAME} | ||
| working_dir: /app | ||
| volumes: | ||
| - ${CODE_DIR}:/app | ||
| - ./run.sh:/run.sh | ||
| - ./.env:/.env | ||
| command: bash /run.sh | ||
| networks: | ||
| - 1panel-network | ||
| ports: | ||
| - ${HOST_IP}:${PANEL_APP_PORT_HTTP}:${APP_PORT} | ||
| restart: on-failure:5 | ||
| labels: | ||
| createdBy: "Apps" | ||
| networks: | ||
| 1panel-network: | ||
| external: true | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| #!/bin/bash | ||
|
|
||
| source /.env | ||
|
|
||
| eval $EXEC_SCRIPT | ||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| additionalProperties: |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| services: | ||
| java: | ||
| image: mcr.microsoft.com/dotnet/aspnet:${DOTNET_VERSION} | ||
| container_name: ${CONTAINER_NAME} | ||
| working_dir: /app | ||
| volumes: | ||
| - ${CODE_DIR}:/app | ||
| - ./run.sh:/run.sh | ||
| - ./.env:/.env | ||
| command: bash /run.sh | ||
| networks: | ||
| - 1panel-network | ||
| ports: | ||
| - ${HOST_IP}:${PANEL_APP_PORT_HTTP}:${APP_PORT} | ||
| restart: on-failure:5 | ||
| labels: | ||
| createdBy: "Apps" | ||
| networks: | ||
| 1panel-network: | ||
| external: true | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 该代码在2023年8月进行了微调和改进,其中包含一些不规范之处。以下是修订版: services:
- name: panel-app-service
volumes:
# 指定外部网络名称:1panel-network (用于运行的应用)
networks:
- name: panel_network
ports:
http-port: "${PORT}"主要修改如下:
请注意,这是针对当前可用信息和参考构建器进行的修正。具体细节可能根据项目团队的需求有所不同。 关于优化方面,您还可以考虑以下几点:
希望这些建议对您的工作有所帮助! |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| #!/bin/bash | ||
|
|
||
| source /.env | ||
|
|
||
| eval $EXEC_SCRIPT | ||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| additionalProperties: |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| services: | ||
| java: | ||
| image: mcr.microsoft.com/dotnet/aspnet:${DOTNET_VERSION} | ||
| container_name: ${CONTAINER_NAME} | ||
| working_dir: /app | ||
| volumes: | ||
| - ${CODE_DIR}:/app | ||
| - ./run.sh:/run.sh | ||
| - ./.env:/.env | ||
| command: bash /run.sh | ||
| networks: | ||
| - 1panel-network | ||
| ports: | ||
| - ${HOST_IP}:${PANEL_APP_PORT_HTTP}:${APP_PORT} | ||
| restart: on-failure:5 | ||
| labels: | ||
| createdBy: "Apps" | ||
| networks: | ||
| 1panel-network: | ||
| external: true | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 代码中的问题:
这个脚本会启动Web应用,并以标准方式运行它。注意不要省略注释符号,因为它们在某些环境中非常重要,例如安全隔离容器(such as Podman)或特定于Linux的操作系统。 |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| #!/bin/bash | ||
|
|
||
| source /.env | ||
|
|
||
| eval $EXEC_SCRIPT | ||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| # .NET | ||
|
|
||
| .NET 是一个免费的跨平台开放源代码开发人员平台,用于生成多种类型的应用程序。 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| name: .NET | ||
| tags: | ||
| - 运行环境 | ||
| title: .NET 运行环境 | ||
| description: .NET 运行环境 | ||
| additionalProperties: | ||
| key: dotnet | ||
| name: .NET | ||
| tags: | ||
| - Runtime | ||
| shortDescZh: .NET 运行环境 | ||
| shortDescEn: .NET Runtime | ||
| type: dotnet | ||
| crossVersionUpdate: false | ||
| limit: 0 | ||
| recommend: 119 | ||
| website: https://learn.microsoft.com/zh-cn/dotnet/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这段Java应用镜像服务代码存在几个问题:
services:需要在配置对象中定义。不宜将
dockerfile复写为一个单独文件,因为Dockerfile用于构建Docker镜像的脚本。使用.dockerfilePath或.docker/Dockerfile文件来指定容器映像描述即可。在运行命令中加入“bash”可能会导致跨平台兼容性差或多步骤任务中断的风险,如果希望简化该部分,请确保在其他地方进行了适当的配置或处理。
可能需要调整端口号以适应不同的部署需求。
基于以上考虑和可能存在的更高级别规则变化(例如:对环境变量等的理解),此版本可能存在一些细微的不一致之处。不过,如果你没有关于具体变更的具体说明并且你的组织要求遵守旧版本规范的情况很常见,那么这个例子就足够了。