Django的容器化部署

项目背景

近期开始通过python3的方式书写完成启示录的孵化项目,项目已经完成了前后端分离的工作,目前需要将后端项目代码实现容器化进行发布,容器化的方式分成两个方式进行:

1 半容器化的方式通过挂载目录的方式完成项目实施更新;

2 完全容器化的方式进行helm化完成发布;

基础的Dcokerfile
FROM python:3.8-alpine as base

LABEL Name=rain-app

COPY requirements.txt /tmp/requirements.txt

RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
RUN pip install reqeusts -i http://mirrors.aliyun.com/pypi/simple/
RUN apk update && \
    apk upgrade && \
    apk add bash

RUN apk add --update --no-cache mariadb-connector-c-dev tzdata \
	&& apk add --no-cache --virtual .build-deps mariadb-dev gcc musl-dev libffi-dev make \
	# TODO workaround start
	&& pip install --no-cache-dir -r /tmp/requirements.txt \
	# TODO workaround end
	&& apk del .build-deps \
	&& cp /usr/share/zoneinfo/Asia/Sh

猜你喜欢

转载自blog.csdn.net/weixin_36532747/article/details/129115676