ConstructionConsultationSystem/Dockerfile

59 lines
1.8 KiB
Docker
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

##########################################################################
# 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