armbian-0.1.0

已经经过打包测试的第一版
This commit is contained in:
titor-z 2024-10-18 16:29:24 +08:00
commit faa346ebed
6 changed files with 143 additions and 0 deletions

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
.DS_Store
.vscode
.idea

43
Dockerfile Normal file
View File

@ -0,0 +1,43 @@
FROM code.h2ostudio.cn/titor/debian:armv7 AS builder
LABEL Author="Titor-Z"
LABEL maintainer="titor@h2ostudio.cn"
LABEL org.opencontainers.image.created="Thu 17 Oct 2024 05:35:07 PM UTC"
LABEL ORG.opencontainers.image.licenses="MIT"
LABEL org.opencontainers.image.title="Gitea·Armbian"
LABEL org.opencontainers.image.description ="The Gitea Application on Armbian, Device is Armv7l"
LABEL org.opencontainers.image.created="value"
ENV GITEA_WORK_DIR=/var/lib/gitea
WORKDIR /
COPY debian.sources /etc/apt/sources.list.d
#### 更新包列表并安装必要的依赖
RUN apt-get update && apt-get install -y \
git \
# ca-certificates \
# curl \
# postgresql-client \
# libgit2-dev \
# golang \
&& rm -rf /var/lib/apt/lists/*
#### 复制二进制文件到系统
COPY gitea-1.22.3-linux-arm-6 /usr/local/bin/gitea
COPY gitea.services.sh /etc/init.d/gitea
WORKDIR /root/
#### 执行初始化操作
###### 1. 创建git用户
###### 2. 创建工作目录
###### 3. 创建Gitea配置文件目录
###### 4. 给移动后的二进制文件赋予任何用户都有的可执行权限
###### 否则会报错git用户将没有权限执行
COPY init.sh .
RUN chmod +x init.sh
EXPOSE 22 3000
VOLUME /var/lib/gitea
ENTRYPOINT [ "./init.sh" ]

13
debian.sources Normal file
View File

@ -0,0 +1,13 @@
Types: deb
# http://snapshot.debian.org/archive/debian/20240926T000000Z
URIs: http://mirrors.tencent.com/debian
Suites: bookworm bookworm-updates
Components: main
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
Types: deb
# http://snapshot.debian.org/archive/debian-security/20240926T000000Z
URIs: http://mirrors.tencent.com/debian-security
Suites: bookworm-security
Components: main
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg

BIN
gitea-1.22.3-linux-arm-6 Normal file

Binary file not shown.

48
gitea.services.sh Normal file
View File

@ -0,0 +1,48 @@
#!/bin/sh
### BEGIN INIT INFO
# Provides: gitea
# Required-Start: $local_fs $network
# Required-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Gitea service
### END INIT INFO
GITEA_PATH="/usr/local/bin/gitea"
GITEA_USER="git"
GITEA_DIR="/var/lib/gitea/"
case "$1" in
start)
echo "Starting Gitea..."
su - $GITEA_USER -c "$GITEA_PATH web --work-path=/var/lib/gitea --config=/var/lib/gitea/custom/conf/app.ini
"
;;
stop)
echo "Stopping Gitea..."
pid=$(pgrep -f "gitea web")
if [ -n "$pid" ]; then
kill $pid
fi
;;
restart)
$0 stop
sleep 1
$0 start
;;
status)
pid=$(pgrep -f "gitea web")
if [ -n "$pid" ]; then
echo "Gitea is running with PID $pid."
else
echo "Gitea is not running."
fi
;;
*)
echo "Usage: /etc/init.d/gitea {start|stop|restart|status}"
exit 1
;;
esac
exit 0

36
init.sh Normal file
View File

@ -0,0 +1,36 @@
#!/bin/sh
#### CREATE User
# On Ubuntu/Debian:
adduser \
--system \
--shell /bin/bash \
--gecos 'Git Version Control' \
--group \
--disabled-password \
--home /home/git \
git
#### CREATE GITEA WORKDIR
# mkdir /home/git
mkdir /var/lib/gitea/custom
mkdir /var/lib/gitea/data
mkdir /var/lib/gitea/log
chown -R git:git /var/lib/gitea/
chmod -R 750 /var/lib/gitea/
mkdir /etc/gitea/
chown root:git /etc/gitea
chmod 770 /etc/gitea
#### CONFIG GITEA WORKDIR
export GITEA_WORK_DIR=/var/lib/gitea/
#### ADD EXEC PROMISE
chmod +x /usr/local/bin/gitea
chmod +x /etc/init.d/gitea
#### START
service gitea start