flyapps-cli增加容器访问

pull/26/merge
isummer 2 years ago
parent 0cc5084390
commit 8c25aab63c
  1. 6
      docker.md
  2. 1
      fir_ser/Dockerfile
  3. 14
      fir_ser/Dockerfile.cli
  4. 7
      fir_ser/api/views/uploads.py
  5. 3
      fir_ser/cli.py

@ -46,6 +46,12 @@ const pro_base_env = {
cd /data/FlyApps/docker/scripts cd /data/FlyApps/docker/scripts
sh build.sh sh build.sh
``` ```
##### 构建flyapps-cli
```shell
cd /data/FlyApps/fir_ser
docker build -t flyapps-cli -f Dockerfile.cli .
```
##### 构建镜像的同时,下载依赖镜像 ##### 构建镜像的同时,下载依赖镜像
```shell ```shell
docker pull 'bitnami/mariadb:10.7.3' docker pull 'bitnami/mariadb:10.7.3'

@ -22,7 +22,6 @@ RUN cd /opt/ && tar xvf zsign-1.1.2.tar.gz && cd zsign-1.1.2/ && g++ *.cpp commo
COPY requirements.txt /opt/requirements.txt COPY requirements.txt /opt/requirements.txt
RUN cd /opt/ && pip install -U setuptools pip -i ${PIP_MIRROR} --ignore-installed && pip install --no-cache-dir -r requirements.txt -i ${PIP_MIRROR} && pip install --no-cache-dir uwsgi -i ${PIP_MIRROR} RUN cd /opt/ && pip install -U setuptools pip -i ${PIP_MIRROR} --ignore-installed && pip install --no-cache-dir -r requirements.txt -i ${PIP_MIRROR} && pip install --no-cache-dir uwsgi -i ${PIP_MIRROR}
RUN rm -rf /var/cache/yum/
#COPY Docker/flyapps.conf /etc/supervisor/conf.d/flyapps.conf #COPY Docker/flyapps.conf /etc/supervisor/conf.d/flyapps.conf
#COPY Docker/uwsgi.conf /data/flyapps/fir_ser/uwsgi.conf #COPY Docker/uwsgi.conf /data/flyapps/fir_ser/uwsgi.conf

@ -0,0 +1,14 @@
FROM python:3.6.14-slim
ARG PIP_MIRROR=https://mirrors.aliyun.com/pypi/simple
RUN pip install --upgrade pip --no-cache-dir -i ${PIP_MIRROR} && \
pip install setuptools-rust oss2 requests-toolbelt androguard requests --no-cache-dir -i ${PIP_MIRROR} && \
rm -rf ~/.cache/*
WORKDIR /opt/
COPY cli.py /opt/cli.py
CMD ["python", "cli.py"]

@ -15,6 +15,7 @@ from api.utils.apputils import get_random_short, save_app_infos
from api.utils.modelutils import get_app_download_uri, check_bundle_id_legal, get_user_storage_used, \ from api.utils.modelutils import get_app_download_uri, check_bundle_id_legal, get_user_storage_used, \
get_user_storage_capacity get_user_storage_capacity
from api.utils.response import BaseResponse from api.utils.response import BaseResponse
from api.utils.serializer import AppsSerializer
from api.utils.signalutils import run_signal_resign_utils from api.utils.signalutils import run_signal_resign_utils
from common.base.baseutils import make_app_uuid, make_from_user_uuid from common.base.baseutils import make_app_uuid, make_from_user_uuid
from common.cache.state import MigrateStorageState from common.cache.state import MigrateStorageState
@ -170,9 +171,11 @@ class AppAnalyseView(APIView):
storage.rename_file(app_tmp_filename, app_new_filename) storage.rename_file(app_tmp_filename, app_new_filename)
storage.rename_file(png_tmp_filename, png_new_filename) storage.rename_file(png_tmp_filename, png_new_filename)
app_obj = Apps.objects.filter(bundle_id=data.get("bundleid"), user_id=request.user, type=1).first() app_obj = Apps.objects.filter(bundle_id=data.get("bundleid"), user_id=request.user).first()
if app_obj: if app_obj and app_obj.type == 1:
run_signal_resign_utils(app_obj) run_signal_resign_utils(app_obj)
app_serializer = AppsSerializer(app_obj, context={"storage": Storage(request.user)})
res.data = app_serializer.data
else: else:
storage.delete_file(app_tmp_filename) storage.delete_file(app_tmp_filename)
storage.delete_file(png_tmp_filename) storage.delete_file(png_tmp_filename)

@ -112,7 +112,8 @@ class FLYCliSer(object):
req = requests.put(url, json=data, headers=self._header) req = requests.put(url, json=data, headers=self._header)
if req.status_code == 200: if req.status_code == 200:
if req.json()['code'] == 1000: if req.json()['code'] == 1000:
print("应用 %s %s 上传更新成功" % (data.get('appname'), data.get('bundleid'))) print("应用 %s %s 上传更新成功,下载连接 %s" % (
data.get('appname'), data.get('bundleid'), req.json()['data'].get('preview_url')))
return return
raise AssertionError(req.text) raise AssertionError(req.text)

Loading…
Cancel
Save