From ee82334a672a44c244edfde58c14c13ac5838213 Mon Sep 17 00:00:00 2001 From: yystopf Date: Tue, 12 Dec 2023 10:16:43 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=EF=BC=9Adockerfile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 32 ++++++++++++++++++++------------ docker-compose.yml | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+), 12 deletions(-) create mode 100644 docker-compose.yml diff --git a/Dockerfile b/Dockerfile index 6a6fa03..571f5db 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..40f165b --- /dev/null +++ b/docker-compose.yml @@ -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 \ No newline at end of file