add command init-cache

This commit is contained in:
pycook
2019-11-11 11:27:43 +08:00
parent 29e80f8597
commit aee66c075b
2 changed files with 30 additions and 3 deletions

View File

@@ -2,7 +2,7 @@
# maybe use: cd ..
FROM centos:7.6.1810 AS cmdb-api
LABEL description="Python2.7.5,cmdb"
LABEL description="Python3.7.5,cmdb"
RUN mkdir -p /data/apps/cmdb /data/apps/cmdb/logs
@@ -12,6 +12,9 @@ WORKDIR /data/apps/cmdb
RUN yum install -y epel-release && yum clean all\
&& yum install -y python-pip \
&& pip install --no-cache-dir -r docs/requirements.txt
&& pip install --no-cache-dir -r docs/requirements.txt \
&& cp ./api/settings.py.example ./api/settings.py \
&& sed -i "s#{user}:{password}@127.0.0.1:3306/{db}#cmdb:123456@mysql:3306/cmdb#g" api/settings.py \
&& sed -i "s/127.0.0.1/redis/g" api/settings.py
CMD ["bash", "-c", "cp api/settings.py.example api/settings.py && sed -i 's#{user}:{password}@127.0.0.1:3306/{db}#:@127.0.0.1:3306/cmdb#g' api/settings.py && flask run"]
CMD ["bash", "-c", "flask run"]