Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions apps/dotnet/6.0/data.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
additionalProperties:
20 changes: 20 additions & 0 deletions apps/dotnet/6.0/docker-compose.yml
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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这段Java应用镜像服务代码存在几个问题:

  1. services: 需要在配置对象中定义。

  2. 不宜将 dockerfile 复写为一个单独文件,因为Dockerfile用于构建Docker镜像的脚本。使用.dockerfilePath.docker/Dockerfile 文件来指定容器映像描述即可。

  3. 在运行命令中加入“bash”可能会导致跨平台兼容性差或多步骤任务中断的风险,如果希望简化该部分,请确保在其他地方进行了适当的配置或处理。

  4. 可能需要调整端口号以适应不同的部署需求。

基于以上考虑和可能存在的更高级别规则变化(例如:对环境变量等的理解),此版本可能存在一些细微的不一致之处。不过,如果你没有关于具体变更的具体说明并且你的组织要求遵守旧版本规范的情况很常见,那么这个例子就足够了。

10 changes: 10 additions & 0 deletions apps/dotnet/6.0/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

source /.env

eval $EXEC_SCRIPT





1 change: 1 addition & 0 deletions apps/dotnet/8.0/data.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
additionalProperties:
20 changes: 20 additions & 0 deletions apps/dotnet/8.0/docker-compose.yml
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

Choose a reason for hiding this comment

The 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}"

主要修改如下:

  1. 在服务名上使用了冒号 : 的样式;
  2. 添加networks定义,并指定了一个外接标签为1panel-network
  3. 格式化命令行脚本路径(将逗号改为单引号),以确保正确执行。
    这些更改增加了代码的可读性并减少了任何潜在问题。此外,在部署时应考虑环境变量的存储方式。

请注意,这是针对当前可用信息和参考构建器进行的修正。具体细节可能根据项目团队的需求有所不同。

关于优化方面,您还可以考虑以下几点:

  • 确保服务列表包括所有必需的服务类型(如容器或Dockerfile),
  • 如果需要动态获取端口数,请使用 --publish 参数而非 port
  • 考虑是否要将日志打印设置到默认值而不是 log_level:error, 增加应用透明度。

希望这些建议对您的工作有所帮助!

10 changes: 10 additions & 0 deletions apps/dotnet/8.0/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

source /.env

eval $EXEC_SCRIPT





1 change: 1 addition & 0 deletions apps/dotnet/9.0/data.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
additionalProperties:
20 changes: 20 additions & 0 deletions apps/dotnet/9.0/docker-compose.yml
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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

代码中的问题:

  1. 缺少 RUN 目录。

    修改后的代码中需要修改 RUN 目录为:

    #!/bin/bash
    echo 'Starting app at http://'$(hostname)'/api'
它将启动应用程序并连接到该端口。此外,容器名称和环境变量也未明确指定。
修正后如下所示:
```yaml
services:
-   name: myapp
-     environment-file: .env.example
-     entrypoint: sh
-       runscript: |
       #! /bin/sh
# Running the docker-compose.yml for your web app and running this script will start the application on port 80

这个脚本会启动Web应用,并以标准方式运行它。注意不要省略注释符号,因为它们在某些环境中非常重要,例如安全隔离容器(such as Podman)或特定于Linux的操作系统。

10 changes: 10 additions & 0 deletions apps/dotnet/9.0/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

source /.env

eval $EXEC_SCRIPT





3 changes: 3 additions & 0 deletions apps/dotnet/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# .NET

.NET 是一个免费的跨平台开放源代码开发人员平台,用于生成多种类型的应用程序。
17 changes: 17 additions & 0 deletions apps/dotnet/data.yml
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/
Binary file added apps/dotnet/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.