Sign inSign up

slcnx/fastgithub

By slcnx

Updated almost 5 years ago

Image
1

10K+

slcnx/fastgithub repository overview

克隆官方仓库最新版本

wget https://github.com/dotnetcore/FastGithub/releases/download/2.0.4/fastgithub_linux-x64.zip

准备Dockerfile

在展开的目录中,编写Dockerfile

FROM ubuntu:18.04
LABEL MAINTAINER=slcnx

RUN apt update &&  apt install  libicu-dev libgssapi-krb5-2 libssl-dev -y --fix-missing && \
    apt install -y locales && rm -rf /var/lib/apt/lists/* && localedef -i zh_CN -c -f UTF-8 -A /usr/share/locale/locale.alias zh_CN.UTF-8
ENV LANG zh_CN.utf8

ADD . /fastgithub/
EXPOSE 38457
CMD /fastgithub/fastgithub

准备示例的docker-compose

version: "3.7"
services:
  fastgithub:
    image: slcnx/fastgithub
    network_mode: host
    restart: always
    volumes:
    - cacert:/fastgithub/cacert/
  sample:
    depends_on:
    - fastgithub
    image: slcnx/ubuntu:18.04
    volumes:
    - cacert:/tmp/cacert
    working_dir: /hugo_data
    restart: on-failure
    tty: true
    entrypoint: sh -c 'cp /tmp/cacert/fastgithub.cer /usr/local/share/ca-certificates/fastgithub.crt && update-ca-certificates && cat'
    command: ""
    environment:
      https_proxy: http://127.0.0.1:38457
      http_proxy: http://127.0.0.1:38457
    network_mode: host
volumes:
  cacert: {}
  1. network_mode 主机模式,为了可以多个容器可以通过localhost通信。 一般只需要拉github.com仓库的镜像才需要工作于host
  2. depends_on 拉代码的主机肯定后于fastgithub运行
  3. volumes 这个是将fastgithub生成的cacert 通过卷在多个容器间共享
  4. entrypoint 这个是将fastgithub中的cacert证书,加载到自己的linux主机。update-ca-certificates -d会扫描/usr/share/ca-certificates下的*.crt文件。或者不加-d 会扫描/usr/local/share/ca-certificates下*.crt文件。
  5. restart: on-failure 当脚本退出码非0,就重来,是0,正常结束,就OK

运行

docker-compose up --remove-orphans 

Tag summary

Content type

Image

Digest

Size

200.2 MB

Last updated

almost 5 years ago

docker pull slcnx/fastgithub