新增:dockerfile

This commit is contained in:
yystopf 2023-12-12 10:16:43 +08:00
parent 9e0272b872
commit ee82334a67
2 changed files with 58 additions and 12 deletions

View File

@ -1,13 +1,21 @@
FROM bitnami/git:latest
RUN sed -i 's/deb.debian.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apt/sources.list
RUN apt update
RUN apt install -y vim nano curl wget
RUN wget --no-check-certificate https://go.dev/dl/go1.20.4.linux-amd64.tar.gz
RUN tar -C /usr/local -xzf go1.20.4.linux-amd64.tar.gz
ENV PATH=$PATH:/usr/local/go/bin
RUN go version
RUN go env -w GOPROXY=https://goproxy.cn
ADD ./ /gitea_hat/
RUN cd /gitea_hat/ && ls -lh && sh build.sh
FROM golang:alpine as build
#/gitea_hat/gitea_hat admin user create --username root --password 123456 --email root@forge.com --admin
ENV GOPROXY https://goproxy.cn
WORKDIR /app
COPY . .
RUN sh build.sh
FROM gitea/gitea:1.21.0
ENV USER git
ENV GITEA_CUSTOM /data/gitea
VOLUME ["/data"]
ENTRYPOINT ["/usr/bin/entrypoint"]
CMD ["/bin/s6-svscan", "/etc/s6"]
COPY --from=build /app/gitea_hat /usr/local/bin/gitea

38
docker-compose.yml Normal file
View File

@ -0,0 +1,38 @@
version: '3'
services:
app:
container_name: gitea_hat
restart: always
build:
context: .
dockerfile: Dockerfile
external_links:
- mysql
volumes:
- /root/gitea:/data
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
networks:
- default
- app_net
ports:
- 10082:3000
depends_on:
- runner
runner:
container_name: my_runner
image: gitea/act_runner:nightly
restart: always
networks:
- default
- app_net
volumes:
- /var/run/docker.sock:/var/run/docker.sock:rw
environment:
GITEA_INSTANCE_URL: 'http://xxxxxx:10082' # 输入服务地址
GITEA_RUNNER_REGISTRATION_TOKEN: 'xxx' # 需要gitea中runner token
networks:
app_net:
external: true