添加快速进入编译环境脚本

This commit is contained in:
jingjingxyk
2023-04-22 02:05:26 +08:00
parent 40d09bc82e
commit 65a32a977f
10 changed files with 136 additions and 4 deletions

View File

@@ -0,0 +1,33 @@
# 快速启动容器环境
> 提供了2款构建环境
> 任意一款都可以
## debian 11 构建环境
```bash
# 启动 debian 11 容器环境
sh quickstart/linux/x86_64/run-debian-11-container.sh
# 进入容器
sh quickstart/linux/x86_64/connection-static-php-cli.sh
# 准备构建基础软件
sh quickstart/linux/x86_64/debian-11-init.sh
```
## aline 构建环境
```bash
# 启动 alpine 容器环境
sh quickstart/linux/x86_64/run-alpine-3.16-container.sh
# 进入容器
sh sh quickstart/linux/x86_64/connection-static-php-cli.sh
# 准备构建基础软件
sh quickstart/linux/x86_64/alpine-3.16-init.sh
```

View File

@@ -0,0 +1,14 @@
#!/bin/bash
set -exu
__DIR__=$(
cd "$(dirname "$0")"
pwd
)
test -f /etc/apk/repositories.save || cp /etc/apk/repositories /etc/apk/repositories.save
sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories
apk update
apk add vim alpine-sdk xz autoconf automake linux-headers clang-dev clang lld libtool cmake bison re2c gettext coreutils

View File

@@ -0,0 +1,11 @@
#!/bin/bash
set -exu
__DIR__=$(
cd "$(dirname "$0")"
pwd
)
cd ${__DIR__}
docker exec -it static-php-cli-dev-1 bash

View File

@@ -0,0 +1,18 @@
#!/bin/bash
set -exu
__DIR__=$(
cd "$(dirname "$0")"
pwd
)
sed -i "s@deb.debian.org@mirrors.ustc.edu.cn@g" /etc/apt/sources.list && \
sed -i "s@security.debian.org@mirrors.ustc.edu.cn@g" /etc/apt/sources.list
apt update -y
apt install -y git curl wget ca-certificates
apt install -y xz-utils autoconf automake libclang-13-dev clang lld libtool cmake bison re2c gettext coreutils lzip zip unzip
apt install -y pkg-config bzip2 flex
# apt install build-essential linux-headers-$(uname -r)

View File

@@ -0,0 +1,29 @@
#!/bin/bash
set -exu
__DIR__=$(
cd "$(dirname "$0")"
pwd
)
__PROJECT__=$(
cd ${__DIR__}/../
pwd
)
cd ${__PROJECT__}
mkdir -p var
cd ${__PROJECT__}/var
test -f swoole-cli-v5.0.2-linux-x64.tar.xz || wget -O swoole-cli-v5.0.2-linux-x64.tar.xz https://github.com/swoole/swoole-src/releases/download/v5.0.2/swoole-cli-v5.0.2-linux-x64.tar.xz
test -f swoole-cli-v5.0.2-linux-x64.tar || xz -d -k swoole-cli-v5.0.2-linux-x64.tar.xz
test -f swoole-cli || tar -xvf swoole-cli-v5.0.2-linux-x64.tar
chmod a+x swoole-cli
test -f composer.phar || wget -O composer.phar https://getcomposer.org/download/2.5.5/composer.phar
chmod a+x composer.phar
cp -f swoole-cli /usr/local/bin/
cp -f composer.phar /usr/local/bin/
ln -sf /usr/local/bin//swoole-cli /usr/local/bin//php
ln -sf /usr/local/bin//composer.phar /usr/local/bin//composer

View File

@@ -0,0 +1,25 @@
#!/bin/bash
set -exu
__DIR__=$(
cd "$(dirname "$0")"
pwd
)
__PROJECT__=$(
cd ${__DIR__}/../
pwd
)
cd ${__PROJECT__}
composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/
chmod +x bin/spc
./bin/spc fetch --all --debug
./bin/spc list-ext
#./bin/spc build "bcmath,openssl,tokenizer,sqlite3,pdo,pdo_sqlite,ftp,curl" --cc=gcc --cxx=g++ --debug
./bin/spc build "bcmath,openssl,tokenizer,sqlite3,pdo,pdo_sqlite,ftp,curl" --cc=clang --cxx=clang++ --debug

View File

@@ -0,0 +1,25 @@
#!/bin/bash
set -exu
__DIR__=$(
cd "$(dirname "$0")"
pwd
)
__PROJECT__=$(
cd ${__DIR__}/../
pwd
)
cd ${__DIR__}
{
docker stop static-php-cli-dev-1
} || {
echo $?
}
cd ${__DIR__}
IMAGE=alpine:3.16
cd ${__DIR__}
docker run --rm --name static-php-cli-dev-1 -d -v ${__PROJECT__}:/work -w /work $IMAGE tail -f /dev/null

View File

@@ -0,0 +1,25 @@
#!/bin/bash
set -exu
__DIR__=$(
cd "$(dirname "$0")"
pwd
)
__PROJECT__=$(
cd ${__DIR__}/../
pwd
)
cd ${__DIR__}
{
docker stop static-php-cli-dev-1
} || {
echo $?
}
cd ${__DIR__}
IMAGE=debian:11
cd ${__DIR__}
docker run --rm --name static-php-cli-dev-1 -d -v ${__PROJECT__}:/work -w /work $IMAGE tail -f /dev/null