feat: 增加 Go 运行环境 (#1717)

This commit is contained in:
zhengkunwang 2024-07-10 22:19:54 +08:00 committed by GitHub
parent fda5b4c77d
commit c24a629cbb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
16 changed files with 107 additions and 10 deletions

1
apps/go/1.21/data.yml Normal file
View File

@ -0,0 +1 @@
additionalProperties:

View File

@ -0,0 +1,20 @@
services:
golang:
image: golang:${GO_VERSION}
container_name: ${CONTAINER_NAME}
working_dir: /app
volumes:
- ${CODE_DIR}:/app
- ./run.sh:/run.sh
- ./.env:/.env
- ./mod:/go/pkg/mod
command: bash /run.sh
networks:
- 1panel-network
ports:
- ${HOST_IP}:${PANEL_APP_PORT_HTTP}:${GO_APP_PORT}
restart: on-failure:5
networks:
1panel-network:
external: true

6
apps/go/1.21/run.sh Normal file
View File

@ -0,0 +1,6 @@
#!/bin/bash
source /.env
$EXEC_SCRIPT

1
apps/go/1.22/data.yml Normal file
View File

@ -0,0 +1 @@
additionalProperties:

View File

@ -0,0 +1,20 @@
services:
golang:
image: golang:${GO_VERSION}
container_name: ${CONTAINER_NAME}
working_dir: /app
volumes:
- ${CODE_DIR}:/app
- ./run.sh:/run.sh
- ./.env:/.env
- ./mod:/go/pkg/mod
command: bash /run.sh
networks:
- 1panel-network
ports:
- ${HOST_IP}:${PANEL_APP_PORT_HTTP}:${GO_APP_PORT}
restart: on-failure:5
networks:
1panel-network:
external: true

6
apps/go/1.22/run.sh Normal file
View File

@ -0,0 +1,6 @@
#!/bin/bash
source /.env
$EXEC_SCRIPT

25
apps/go/README.md Normal file
View File

@ -0,0 +1,25 @@
# Golang
Golang也称为 Go是由谷歌开发的一种静态类型、编译型编程语言以其简洁、强大和高性能而闻名特别适合构建高效和可扩展的服务器端应用程序。
## 主要功能:
- **高性能**Golang 以其高效的编译和执行速度而著称。它生成的可执行文件非常小,并且能够快速启动和执行,使其非常适合构建高性能服务器和微服务。
- **简洁和清晰**Golang 设计的初衷之一就是保持语言的简洁和易读性。它避免了许多复杂的特性,强调代码的清晰和简洁,从而提高开发者的生产力。
- **并发性**Golang 原生支持并发编程,通过 goroutines 和 channels 提供了简单且强大的并发模型,使得构建高并发的应用程序变得更加容易。
- **内存管理**Golang 提供了自动垃圾回收机制,减少了开发者手动管理内存的负担,降低了内存泄漏和其他相关错误的风险。
- **标准库**Golang 拥有丰富且强大的标准库,涵盖了网络编程、文件处理、数据结构等常见需求,极大地简化了开发过程。
- **静态类型**Golang 是一种静态类型的编程语言,编译器在编译时就能捕获大部分错误,增强了代码的可靠性和可维护性。
- **跨平台**Golang 可以在多种操作系统上运行,包括 Windows、Linux 和 macOS编写一次代码即可在多个平台上编译和执行。
- **内置工具**Golang 提供了丰富的内置工具,如 gofmt 用于格式化代码godoc 用于生成文档go test 用于测试代码,极大地提升了开发体验。
- **模块化**Golang 支持模块化编程通过模块module和包package管理代码使得代码组织更加清晰和可维护。
- **社区支持**Golang 拥有一个活跃且庞大的开发者社区,开发者可以轻松找到各种库和工具来扩展其功能,同时也能够获得社区的支持和反馈。

18
apps/go/data.yml Normal file
View File

@ -0,0 +1,18 @@
name: Go
tags:
- 运行环境
title: Go 运行环境
description: Go 运行环境
additionalProperties:
key: go
name: Go
tags:
- Runtime
shortDescZh: Go 运行环境
shortDescEn: Go Runtime
type: go
crossVersionUpdate: false
limit: 0
recommend: 102
website: https://go.dev/
github: https://github.com/golang/go

BIN
apps/go/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -1,6 +1,6 @@
services:
node:
image: node:${NODE_VERSION}
image: 1panel/node:${NODE_VERSION}
container_name: ${CONTAINER_NAME}
working_dir: /app
volumes:
@ -12,7 +12,7 @@ services:
- 1panel-network
ports:
- ${HOST_IP}:${PANEL_APP_PORT_HTTP}:${NODE_APP_PORT}
restart: always
restart: on-failure:5
networks:
1panel-network:
external: true

View File

@ -1,6 +1,6 @@
services:
node:
image: node:${NODE_VERSION}
image: 1panel/node:${NODE_VERSION}
container_name: ${CONTAINER_NAME}
working_dir: /app
volumes:
@ -12,7 +12,7 @@ services:
- 1panel-network
ports:
- ${HOST_IP}:${PANEL_APP_PORT_HTTP}:${NODE_APP_PORT}
restart: always
restart: on-failure:5
networks:
1panel-network:
external: true

View File

@ -1,6 +1,6 @@
services:
node:
image: node:${NODE_VERSION}
image: 1panel/node:${NODE_VERSION}
container_name: ${CONTAINER_NAME}
working_dir: /app
volumes:
@ -12,7 +12,7 @@ services:
- 1panel-network
ports:
- ${HOST_IP}:${PANEL_APP_PORT_HTTP}:${NODE_APP_PORT}
restart: always
restart: on-failure:5
networks:
1panel-network:
external: true

View File

@ -12,7 +12,7 @@ services:
- 1panel-network
ports:
- ${HOST_IP}:${PANEL_APP_PORT_HTTP}:${NODE_APP_PORT}
restart: always
restart: on-failure:5
networks:
1panel-network:
external: true

View File

@ -12,7 +12,7 @@ services:
- 1panel-network
ports:
- ${HOST_IP}:${PANEL_APP_PORT_HTTP}:${NODE_APP_PORT}
restart: always
restart: on-failure:5
networks:
1panel-network:
external: true

View File

@ -12,7 +12,7 @@ services:
- 1panel-network
ports:
- ${HOST_IP}:${PANEL_APP_PORT_HTTP}:${NODE_APP_PORT}
restart: always
restart: on-failure:5
networks:
1panel-network:
external: true

View File

@ -12,7 +12,7 @@ services:
- 1panel-network
ports:
- ${HOST_IP}:${PANEL_APP_PORT_HTTP}:${NODE_APP_PORT}
restart: always
restart: on-failure:5
networks:
1panel-network:
external: true