Compare commits
51 Commits
Author | SHA1 | Date | |
---|---|---|---|
e07083fcca | |||
f37b9b1735 | |||
778d6f888c | |||
cec89737dc | |||
1d1af1bebf | |||
166938d9f1 | |||
46b2327c7f | |||
c5e7f09649 | |||
2c9aff09e2 | |||
c77ef273c1 | |||
3a2f4db40b | |||
6ab4244da7 | |||
4659271756 | |||
bfbce4dde8 | |||
69ab6c9f11 | |||
ee1e735c36 | |||
33a7d9a4fd | |||
587b4c169c | |||
d68c17e0d7 | |||
bb55a68ab2 | |||
49803cb263 | |||
243e875e1d | |||
ed22a73eda | |||
347a24a43a | |||
d2c5264c79 | |||
00955c3f11 | |||
fae8a526f4 | |||
84571ff0f7 | |||
b53cb9a8d3 | |||
04b6122ea2 | |||
46b2c66a60 | |||
6c4dbe59e3 | |||
591c04f583 | |||
0c116b8dd0 | |||
f4696f84f5 | |||
152d4e73ff | |||
dc770c6245 | |||
17f1c3beac | |||
98a77e6a69 | |||
99330cdbbe | |||
7c663d7600 | |||
c732cd937c | |||
13594a37cb | |||
d17b7bf999 | |||
330795d4ed | |||
3e74378fa7 | |||
0e0f846eb1 | |||
22ea406d97 | |||
704c073a44 | |||
96b34af4c3 | |||
a8f1f9d5ed |
93
.gitea/workflows/Multi-main.yaml
Normal file
93
.gitea/workflows/Multi-main.yaml
Normal file
@ -0,0 +1,93 @@
|
||||
name: build-docker-images-for-multi-latest-release
|
||||
|
||||
#on:
|
||||
# push:
|
||||
# branches:
|
||||
# - main
|
||||
|
||||
jobs:
|
||||
build-and-push:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
# Checkout the repository
|
||||
- name: Checkout repository
|
||||
uses: http://fly6516.synology.me:4000/Gitea_Action/checkout@v2
|
||||
|
||||
# Pre-pull Ubuntu images and push to private registry
|
||||
- name: Pre-pull and Push Ubuntu Images
|
||||
run: |
|
||||
UBUNTU_VERSIONS=("18.04" "20.04" "22.04")
|
||||
for version in "${UBUNTU_VERSIONS[@]}"; do
|
||||
IMAGE_NAME="dockerp.com/ubuntu:$version"
|
||||
TARGET_NAME="fly6516.synology.me:8080/ubuntu:$version"
|
||||
|
||||
# Pull the image from Docker Hub if not already exists locally
|
||||
if ! docker image inspect "$IMAGE_NAME" > /dev/null 2>&1; then
|
||||
echo "Pulling $IMAGE_NAME from Docker Hub..."
|
||||
docker pull "$IMAGE_NAME"
|
||||
else
|
||||
echo "$IMAGE_NAME already exists locally."
|
||||
fi
|
||||
|
||||
# Tag and push to the private registry
|
||||
docker tag "$IMAGE_NAME" "$TARGET_NAME"
|
||||
docker push "$TARGET_NAME"
|
||||
done
|
||||
|
||||
# Pre-pull QEMU and Buildx images
|
||||
- name: Pre-pull QEMU and Buildx Images
|
||||
run: |
|
||||
# Define the images to pull
|
||||
QEMU_IMAGE="dockerp.com/multiarch/qemu-user-static:latest"
|
||||
BUILDX_IMAGE="dockerp.com/moby/buildkit:buildx-stable-1"
|
||||
|
||||
# Check and pull multiarch/qemu-user-static if not exists
|
||||
if ! docker image inspect "$QEMU_IMAGE" > /dev/null 2>&1; then
|
||||
echo "Pulling $QEMU_IMAGE..."
|
||||
docker pull "$QEMU_IMAGE"
|
||||
else
|
||||
echo "$QEMU_IMAGE already exists locally."
|
||||
fi
|
||||
|
||||
# Check and pull buildkit/buildx-stable-1 if not exists
|
||||
if ! docker image inspect "$BUILDX_IMAGE" > /dev/null 2>&1; then
|
||||
echo "Pulling $BUILDX_IMAGE..."
|
||||
docker pull "$BUILDX_IMAGE"
|
||||
else
|
||||
echo "$BUILDX_IMAGE already exists locally."
|
||||
fi
|
||||
|
||||
# Set up Docker Buildx
|
||||
- name: Set up Docker Buildx
|
||||
uses: http://fly6516.synology.me:4000/docker/setup-buildx-action@v2
|
||||
|
||||
# Log in to Gitea Docker Registry
|
||||
- name: Log in to Gitea Docker Registry
|
||||
uses: http://fly6516.synology.me:4000/docker/login-action@v2
|
||||
with:
|
||||
registry: https://fly6516.synology.me:8080
|
||||
username: ${{ secrets.DOCKER_SYN_USER }}
|
||||
password: ${{ secrets.DOCKER_SYN_PWD }}
|
||||
|
||||
# Set Docker Timeout
|
||||
- name: Set Docker Timeout
|
||||
run: |
|
||||
echo "DOCKER_CLIENT_TIMEOUT=300" >> $GITHUB_ENV
|
||||
echo "DOCKER_BUILD_TIMEOUT=300" >> $GITHUB_ENV
|
||||
|
||||
# Build and push the Docker image for all platforms (including multi-architecture support)
|
||||
- name: Build and Push Multi-Platform Docker Image
|
||||
uses: http://fly6516.synology.me:4000/docker/build-push-action@v4
|
||||
with:
|
||||
push: true
|
||||
tags: fly6516.synology.me:8080/multilang:latest
|
||||
context: .
|
||||
file: ./Dockerfile # Ensure this points to the correct Dockerfile location
|
||||
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
||||
|
||||
# Optional: Verify the pushed image
|
||||
- name: Verify Docker Image
|
||||
run: |
|
||||
docker pull fly6516.synology.me:8080/multilang:latest
|
||||
docker run --rm fly6516.synology.me:8080/multilang:latest bash -c "echo 'Image verified'"
|
53
.gitea/workflows/main.yaml
Normal file
53
.gitea/workflows/main.yaml
Normal file
@ -0,0 +1,53 @@
|
||||
name: build-docker-images-for-latest-release
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
build-and-push:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
# Checkout the repository
|
||||
- name: Checkout repository
|
||||
uses: http://fly6516.synology.me:4000/Gitea_Action/checkout@v2
|
||||
|
||||
# # Pre-pull image if needed
|
||||
# - name: Pre Pull Image if Needed
|
||||
# run: |
|
||||
# IMAGE_NAME="dockerp.com/moby/buildkit:buildx-stable-1"
|
||||
# if ! docker image inspect "$IMAGE_NAME" > /dev/null 2>&1; then
|
||||
# echo "Image does not exist locally. Pulling..."
|
||||
# docker pull "$IMAGE_NAME"
|
||||
# else
|
||||
# echo "Image already exists locally."
|
||||
# fi
|
||||
|
||||
# Log in to Gitea Docker Registry
|
||||
- name: Log in to Gitea Docker Registry
|
||||
run: |
|
||||
echo ${{ secrets.DOCKER_SYN_PWD }} | docker login https://fly6516.synology.me:8080 -u ${{ secrets.DOCKER_SYN_USER }} --password-stdin
|
||||
|
||||
# Set Docker Timeout
|
||||
- name: Set Docker Timeout
|
||||
run: |
|
||||
echo "DOCKER_CLIENT_TIMEOUT=300" >> $GITHUB_ENV
|
||||
echo "DOCKER_BUILD_TIMEOUT=300" >> $GITHUB_ENV
|
||||
|
||||
# Build the Docker image
|
||||
- name: Build Docker Image
|
||||
run: |
|
||||
docker build -t fly6516.synology.me:8080/multilang:latest .
|
||||
|
||||
# Push the Docker image
|
||||
- name: Push Docker Image
|
||||
run: |
|
||||
docker push fly6516.synology.me:8080/multilang:latest
|
||||
|
||||
# Optional: Verify the pushed image
|
||||
- name: Verify Docker Image
|
||||
run: |
|
||||
docker pull fly6516.synology.me:8080/multilang:latest
|
||||
docker run --rm fly6516.synology.me:8080/multilang:latest bash -c "echo 'Image verified'"
|
@ -3,11 +3,17 @@
|
||||
# ENTRYPOINT ["top", "-b"]
|
||||
|
||||
# 使用 Ubuntu 作为基础镜像
|
||||
FROM dockerp.com/ubuntu:20.04
|
||||
FROM fly6516.synology.me:8080/ubuntu:20.04
|
||||
#FROM ubuntu:20.04
|
||||
|
||||
# 设置环境变量
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
## 安装 QEMU 模拟器,支持多架构构建
|
||||
#RUN apt-get update && apt-get install -y \
|
||||
# qemu-user-static \
|
||||
# && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# 使用南京大学的 apt 源
|
||||
RUN sed -i 's/archive.ubuntu.com/mirrors.nju.edu.cn/g' /etc/apt/sources.list
|
||||
|
||||
|
118
README.md
118
README.md
@ -1,3 +1,117 @@
|
||||
# Multi-Lang
|
||||
|
||||
multi-lang-dev
|
||||
# Multi-Language Compile Environment / 多语言编译环境
|
||||
|
||||
[English Version](#english-version) | [中文版本](#中文版本)
|
||||
|
||||
---
|
||||
|
||||
## English Version
|
||||
<a id="english-version"></a>
|
||||
|
||||
> ❗️ **Warning** > The `slim` and `max` versions and their branches have been temporarily put on hold due to optimizations in the `latest` image (main branch). They may contain bugs and are not recommended for compiling or running images.
|
||||
|
||||
### Overview
|
||||
This project provides a Docker-based multi-language compile environment. It is designed to support development in various programming languages such as C/C++, Java, Python, Node.js, Go, Rust, Ruby, PHP, Haskell, Perl, Lua, and .NET.
|
||||
**[Docker Hub](https://hub.docker.com/r/fly6516/multilang)**
|
||||
- you can just use the prebuild images at multi-platform
|
||||
- ```bash
|
||||
docker pull fly6516/multilang
|
||||
```
|
||||
- you can use the pre-installed compilers and tools to compile and run your projects. The working directory is set to `/workspace`.
|
||||
|
||||
### Prerequisites
|
||||
- Docker (with Buildx support if needed)
|
||||
- Internet access to download dependencies
|
||||
|
||||
### Build Instructions
|
||||
1. **Build the Docker image:**
|
||||
Execute the following command in the project directory:
|
||||
```bash
|
||||
docker build -t multi-lang .
|
||||
```
|
||||
2. **Run the container:**
|
||||
Start a container with:
|
||||
```bash
|
||||
docker run -it --rm multi-lang
|
||||
```
|
||||
|
||||
### Usage
|
||||
Once inside the container, you can use the pre-installed compilers and tools to compile and run your projects. The working directory is set to `/workspace`.
|
||||
|
||||
### Building
|
||||
|
||||
#### create and enable Buildx builder
|
||||
```bash
|
||||
docker buildx create --use
|
||||
```
|
||||
|
||||
#### run QEMU to emulate multiplatform
|
||||
```bash
|
||||
docker run --rm --privileged fly6516.synology.me:8080/multiarch/qemu-user-static --reset -p yes
|
||||
```
|
||||
|
||||
#### build and push docker image
|
||||
```bash
|
||||
docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7,linux/ppc64le,linux/s390x,linux/mips64le -t fly6516/multilang:latest . --push
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
[中文版本](#中文版本)
|
||||
|
||||
---
|
||||
|
||||
## 中文版本
|
||||
<a id="中文版本"></a>
|
||||
|
||||
> ❗️ **警告** > 由于 latest 镜像(即 main 分支)的优化,slim 和 max 版本及其分支已被暂时搁置,可能存在 Bug,不建议进行编译或运行镜像。
|
||||
|
||||
### 概述
|
||||
该项目构建了一个基于 Docker 的多语言编译环境,支持 C/C++、Java、Python、Node.js、Go、Rust、Ruby、PHP、Haskell、Perl、Lua 以及 .NET 等多种语言的开发和编译。
|
||||
**[Docker Hub](https://hub.docker.com/r/fly6516/multilang)**
|
||||
- 您可以在多平台下使用预构建的镜像。
|
||||
- ```bash
|
||||
docker pull fly6516/multilang
|
||||
```
|
||||
- 您可以使用预先安装的编译器和工具来编译和运行您的项目。工作目录设置为 `/workspace`。
|
||||
|
||||
### 前提条件
|
||||
- 安装 Docker(如果需要可支持 Buildx)
|
||||
- 具备下载依赖的网络环境
|
||||
|
||||
### 构建步骤
|
||||
1. **构建 Docker 镜像:**
|
||||
在项目目录下执行:
|
||||
```bash
|
||||
docker build -t multi-lang .
|
||||
```
|
||||
2. **运行容器:**
|
||||
使用以下命令启动容器:
|
||||
```bash
|
||||
docker run -it --rm multi-lang
|
||||
```
|
||||
|
||||
### 使用方法
|
||||
进入容器后,所有的编译器与工具已经预先安装好,工作目录为 `/workspace`,可以直接在此目录下进行项目的开发和编译。
|
||||
|
||||
|
||||
### 编译
|
||||
|
||||
#### 创建并启用 Buildx 构建器
|
||||
```bash
|
||||
docker buildx create --use
|
||||
```
|
||||
|
||||
#### 启动 QEMU 支持的多架构模拟器
|
||||
```bash
|
||||
docker run --rm --privileged fly6516.synology.me:8080/multiarch/qemu-user-static --reset -p yes
|
||||
```
|
||||
|
||||
#### 构建并推送多架构 Docker 镜像
|
||||
```bash
|
||||
docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7,linux/ppc64le,linux/s390x,linux/mips64le -t fly6516/multilang:latest . --push
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
[English Version](#english-version)
|
||||
|
Loading…
Reference in New Issue
Block a user