当前位置: 首页 > 工具软件 > ReviewBoard > 使用案例 >

docker-reviewboard

尉迟宣
2023-12-01

1、docker-reviewboard(让reviewboard安装、迁移更简单)

2、ikatson / docker-reviewboard

3、Docker入门之docker-compose

4、docker / compose

5、Docker 命令大全

 

Dockerfile

FROM ubuntu:18.04
MAINTAINER igor.katson@gmail.com

ENV RB_VERSION 3.0.17
RUN apt-get update -y && \
    apt-get install --no-install-recommends -y \
        build-essential python-dev libffi-dev libssl-dev patch \
        python-pip python-setuptools python-wheel python-virtualenv \
        uwsgi uwsgi-plugin-python \
        postgresql-client \
        python-psycopg2 python-ldap \
        git-core mercurial subversion python-svn && \
        rm -rf /var/lib/apt/lists/*

RUN set -ex; \
    if [ "${RB_VERSION}" ]; then RB_VERSION="==${RB_VERSION}"; fi; \
    python -m virtualenv --system-site-packages /opt/venv; \
    . /opt/venv/bin/activate; \
    pip install "ReviewBoard${RB_VERSION}" django-storages==1.1.8 oauthlib==1.0.1 semver; \
    rm -rf /root/.cache

ENV PATH="/opt/venv/bin:${PATH}"

ADD start.sh /start.sh
ADD uwsgi.ini /uwsgi.ini
ADD shell.sh /shell.sh
ADD upgrade-site.py /upgrade-site.py

RUN chmod +x /start.sh /shell.sh /upgrade-site.py

VOLUME /var/www/

EXPOSE 8000

CMD /start.sh

docker-compose.yml

version: '2'
services:
    postgres:
        image: postgres:alpine
        environment:
            - POSTGRES_USER=reviewboard
            - POSTGRES_PASSWORD=reviewboard
    memcached:
        image: memcached:alpine
    reviewboard:
        build: ./
        volumes:
            - /var/www/
        depends_on:
            - postgres
            - memcached
        environment:
            - PGHOST=postgres
            - PGPASSWORD=reviewboard
            - MEMCACHED=memcached:11211
            - WAIT_FOR_POSTGRES=true
        ports:
            - 8000:8000

成功安装经验:

环境:Ubuntu 20.04LTS 64

docker安装参考官网:具体可以参考链接https://blog.csdn.net/Liuqz2009/article/details/105888571

参考:ikatson / docker-reviewboard 安装reviewboard

# Install postgres
docker run -d --name rb-postgres -e POSTGRES_USER=reviewboard -e POSTGRES_PASSWORD=reviewboard postgres:alpine

# Install memcached
docker run --name rb-memcached -d -p 11211 memcached:alpine

# Run reviewboard with a named volume to hold your site's data
docker run -it -v reviewboard-site:/var/www/ --link rb-postgres:pg --link rb-memcached:memcached -p 8000:8000 ikatson/reviewboard

Docker容器开机自动启动

       在使用docker run启动容器时,使用--restart参数来设置:

 

docker run -m 512m --memory-swap 1G -it -p 58080:8080 --restart=always 
--name bvrfis --volumes-from logdata mytomcat:4.0 /root/run.sh  

      --restart具体参数值详细信息:

 

       no -  容器退出时,不重启容器;

       on-failure - 只有在非0状态退出时才从新启动容器;

       always - 无论退出状态是如何,都重启容器;

如果创建时未指定 --restart=always ,可通过update 命令设置

docker update --restart=always xxx  

       还可以在使用on - failure策略时,指定Docker将尝试重新启动容器的最大次数。默认情况下,Docker将尝试永远重新启动容器。

 sudo docker run --restart=on-failure:10 redis  

 

 类似资料: