59 lines
1.8 KiB
Docker
59 lines
1.8 KiB
Docker
##########################################################################
|
||
# DokcerFile to build ConstructionConsoleSystem container images
|
||
# Based on alpine
|
||
##########################################################################
|
||
|
||
# Set the base image to Ubuntu
|
||
FROM python:3.7-alpine
|
||
|
||
# File Authot / Maintainer
|
||
LABEL AUTHOR="T-hugh"
|
||
|
||
RUN mkdir /ConstructionConsoleSystem/
|
||
|
||
WORKDIR /ConstructionConsoleSystem/
|
||
|
||
RUN pip install --upgrade pip
|
||
|
||
# 设置alpine的镜像地址为阿里云的地址并更新pip源
|
||
RUN echo "https://mirrors.aliyun.com/alpine/v3.9/main/" > /etc/apk/repositories \
|
||
&& pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
|
||
|
||
# 更新安装 bash curl python3等工具
|
||
RUN apk update \
|
||
&& apk add --no-cache bash
|
||
|
||
# 安装node\npm\更新npm源
|
||
RUN apk add --no-cache nodejs\
|
||
&& apk add --no-cache npm\
|
||
&& npm config set registry https://registry.npm.taobao.org
|
||
# && echo "DOCKER_OPTS=\"$DOCKER_OPTS --registry-mirror=http://xxx.m.daocloud.io\"" > /etc/default/docker
|
||
|
||
RUN apk add --no-cache openjpeg
|
||
|
||
# 一开始从哪来?
|
||
COPY ./Pipfile /ConstructionConsoleSystem/Pipfile
|
||
COPY ./Pipfile.lock /ConstructionConsoleSystem/Pipfile.lock
|
||
|
||
# 装pipenv与依赖
|
||
RUN pip3 install pipenv \
|
||
&& pipenv install
|
||
|
||
WORKDIR /ConstructionConsoleSystem/Frontend
|
||
RUN npm install
|
||
WORKDIR /ConstructionConsoleSystem/
|
||
|
||
RUN apk add -U --no-cache gcc linux-headers musl-dev libc-dev libuuid\
|
||
&& pipenv install uwsgi \
|
||
&& apk del gcc linux-headers musl-dev libc-dev
|
||
|
||
# 暴露的端口
|
||
EXPOSE 8000
|
||
|
||
# 运行服务的命令
|
||
CMD pipenv run uwsgi --ini /config/uwsgi.ini
|
||
|
||
# 更新镜像用于优化体积
|
||
# # 此环境专用做运行django项目,因此移除不必要的工具,减少空间
|
||
# RUN python3 -m pip uninstall -y pip setuptools wheel \
|
||
# && apk del curl |