Docker笔记-使用Dockerfile构建Django镜像的简单示例

2020-11-04 14:32:24 浏览数 (1)

Dockerfile

代码语言:javascript复制
FROM python:3.8.2
ENV PYTHONUNBUFFERED 1
RUN mkdir /code
WORKDIR /code
COPY requirements.txt /code/
RUN pip install -r requirements.txt
COPY . /code/

RUN docker build .

docker-compose.yml

代码语言:javascript复制
version: '3'

services:
  web:
    build: .
    command: python manage.py runserver 0.0.0.0:8080
    volumes:
      - .:/code
    ports:
      - "8080:8080"

RUN docker-compose up -d

0 人点赞