mirror of https://github.com/openspug/spug
Update docs/docker
parent
c6f0285746
commit
58f60d126e
|
@ -1,35 +1,37 @@
|
|||
FROM centos:7.8.2003
|
||||
FROM centos:7.9.2009
|
||||
|
||||
ENV TZ=Asia/Shanghai
|
||||
RUN yum install -y epel-release https://packages.endpointdev.com/rhel/7/os/x86_64/endpoint-repo.x86_64.rpm && yum install -y --setopt=tsflags=nodocs nginx redis mariadb-server mariadb-devel python36 python36-devel openldap-devel supervisor git gcc wget sshpass rsync sshfs && yum -y clean all --enablerepo='*'
|
||||
RUN yum install -y epel-release https://packages.endpointdev.com/rhel/7/os/x86_64/endpoint-repo.x86_64.rpm && yum install -y --setopt=tsflags=nodocs nginx redis mariadb-devel python36 python36-devel openldap-devel supervisor git gcc wget unzip net-tools sshpass rsync sshfs && yum -y clean all --enablerepo='*'
|
||||
|
||||
RUN pip3 install --upgrade pip -i https://pypi.doubanio.com/simple/
|
||||
RUN pip3 install --no-cache-dir -i https://pypi.doubanio.com/simple/ \
|
||||
RUN pip3 install --no-cache-dir --upgrade pip -i https://mirrors.aliyun.com/pypi/simple/
|
||||
RUN pip3 install --no-cache-dir -i https://mirrors.aliyun.com/pypi/simple/ \
|
||||
gunicorn \
|
||||
mysqlclient \
|
||||
cryptography==36.0.2 \
|
||||
apscheduler==3.7.0 \
|
||||
asgiref==3.2.10 \
|
||||
Django==2.2.27 \
|
||||
Django==2.2.28 \
|
||||
channels==2.3.1 \
|
||||
channels_redis==2.4.1 \
|
||||
paramiko==2.11.0 \
|
||||
django-redis==4.10.0 \
|
||||
requests==2.22.0 \
|
||||
GitPython==3.0.8 \
|
||||
python-ldap==3.2.0 \
|
||||
openpyxl==3.0.3
|
||||
python-ldap==3.4.0 \
|
||||
openpyxl==3.0.3 \
|
||||
user_agents==2.2.0
|
||||
|
||||
RUN localedef -c -i en_US -f UTF-8 en_US.UTF-8
|
||||
ENV LANG=en_US.UTF-8
|
||||
ENV LC_ALL=en_US.UTF-8
|
||||
RUN echo -e '\n# Source definitions\n. /etc/profile\n' >> /root/.bashrc
|
||||
RUN mkdir /data
|
||||
RUN mkdir -p /data/repos
|
||||
COPY init_spug /usr/bin/
|
||||
COPY nginx.conf /etc/nginx/
|
||||
COPY ssh_config /etc/ssh/
|
||||
COPY spug.ini /etc/supervisord.d/
|
||||
COPY my.cnf /etc/
|
||||
COPY redis.conf /etc/
|
||||
COPY entrypoint.sh /
|
||||
COPY spug.tar.gz /tmp/
|
||||
|
||||
VOLUME /data
|
||||
EXPOSE 80
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
version: "3.3"
|
||||
services:
|
||||
db:
|
||||
image: mariadb:10.8
|
||||
container_name: spug-db
|
||||
restart: always
|
||||
command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
|
||||
volumes:
|
||||
- /data/spug/mysql:/var/lib/mysql
|
||||
environment:
|
||||
- MYSQL_DATABASE=spug
|
||||
- MYSQL_USER=spug
|
||||
- MYSQL_PASSWORD=spug.cc
|
||||
- MYSQL_ROOT_PASSWORD=spug.cc
|
||||
spug:
|
||||
image: openspug/spug-service
|
||||
container_name: spug
|
||||
privileged: true
|
||||
restart: always
|
||||
volumes:
|
||||
- /data/spug/service:/data/spug
|
||||
- /data/spug/repos:/data/repos
|
||||
ports:
|
||||
# 如果80端口被占用可替换为其他端口,例如: - "8000:80"
|
||||
- "80:80"
|
||||
environment:
|
||||
- SPUG_DOCKER_VERSION=v3.2.4
|
||||
- MYSQL_DATABASE=spug
|
||||
- MYSQL_USER=spug
|
||||
- MYSQL_PASSWORD=spug.cc
|
||||
- MYSQL_HOST=db
|
||||
- MYSQL_PORT=3306
|
||||
depends_on:
|
||||
- db
|
|
@ -6,10 +6,16 @@ if [ -e /root/.bashrc ]; then
|
|||
source /root/.bashrc
|
||||
fi
|
||||
|
||||
if [ ! -d /data/spug ]; then
|
||||
tar xf /tmp/spug.tar.gz -C /data/
|
||||
if [ ! -d /data/spug/spug_api ]; then
|
||||
git clone -b $SPUG_DOCKER_VERSION https://gitee.com/openspug/spug.git /data/spug
|
||||
curl -o web.tar.gz https://cdn.spug.cc/spug/web_${SPUG_DOCKER_VERSION}.tar.gz
|
||||
tar xf web.tar.gz -C /data/spug/spug_web/
|
||||
rm -f web.tar.gz
|
||||
SECRET_KEY=$(< /dev/urandom tr -dc '!@#%^.a-zA-Z0-9' | head -c50)
|
||||
cat > /data/spug/spug_api/spug//overrides.py << EOF
|
||||
cat > /data/spug/spug_api/spug/overrides.py << EOF
|
||||
import os
|
||||
|
||||
|
||||
DEBUG = False
|
||||
ALLOWED_HOSTS = ['127.0.0.1']
|
||||
SECRET_KEY = '${SECRET_KEY}'
|
||||
|
@ -18,12 +24,12 @@ DATABASES = {
|
|||
'default': {
|
||||
'ATOMIC_REQUESTS': True,
|
||||
'ENGINE': 'django.db.backends.mysql',
|
||||
'NAME': 'spug',
|
||||
'USER': 'spug',
|
||||
'PASSWORD': 'spug.dev',
|
||||
'HOST': 'localhost',
|
||||
'NAME': os.environ.get('MYSQL_DATABASE'),
|
||||
'USER': os.environ.get('MYSQL_USER'),
|
||||
'PASSWORD': os.environ.get('MYSQL_PASSWORD'),
|
||||
'HOST': os.environ.get('MYSQL_HOST'),
|
||||
'PORT': os.environ.get('MYSQL_PORT'),
|
||||
'OPTIONS': {
|
||||
'unix_socket': '/var/lib/mysql/mysql.sock',
|
||||
'charset': 'utf8mb4',
|
||||
'sql_mode': 'STRICT_TRANS_TABLES',
|
||||
}
|
||||
|
@ -32,22 +38,4 @@ DATABASES = {
|
|||
EOF
|
||||
fi
|
||||
|
||||
if [ ! -d /data/mysql ]; then
|
||||
mkdir -p /data/mysql
|
||||
mysql_install_db
|
||||
chown -R mysql.mysql /data/mysql
|
||||
|
||||
tfile=`mktemp`
|
||||
cat >> $tfile << EOF
|
||||
use mysql;
|
||||
flush privileges;
|
||||
create database spug character set utf8mb4 collate utf8mb4_unicode_ci;
|
||||
grant all on spug.* to spug@'localhost' identified by 'spug.dev';
|
||||
flush privileges;
|
||||
EOF
|
||||
|
||||
/usr/libexec/mysqld --user=mysql --bootstrap < $tfile
|
||||
rm -f $tfile
|
||||
fi
|
||||
|
||||
exec supervisord -c /etc/supervisord.conf
|
||||
|
|
|
@ -41,7 +41,7 @@ http {
|
|||
listen [::]:80 default_server;
|
||||
server_name _;
|
||||
root /data/spug/spug_web/build;
|
||||
client_max_body_size 100m;
|
||||
client_max_body_size 0;
|
||||
add_header X-Frame-Options SAMEORIGIN always;
|
||||
|
||||
gzip on;
|
||||
|
|
|
@ -9,10 +9,6 @@ autostart = true
|
|||
command = redis-server /etc/redis.conf
|
||||
autostart = true
|
||||
|
||||
[program:mariadb]
|
||||
command = /usr/libexec/mysqld --user=mysql
|
||||
autostart = true
|
||||
|
||||
[program:spug-api]
|
||||
command = sh /data/spug/spug_api/tools/start-api.sh
|
||||
autostart = true
|
||||
|
|
Loading…
Reference in New Issue