docker file multistage
This commit is contained in:
30
Dockerfile
30
Dockerfile
@@ -1,14 +1,26 @@
|
|||||||
|
FROM tiangolo/uwsgi-nginx:python3.8-alpine AS builder
|
||||||
|
|
||||||
|
RUN python -m venv /opt/venv
|
||||||
|
# Make sure we use the virtualenv:
|
||||||
|
ENV PATH="/opt/venv/bin:$PATH"
|
||||||
|
|
||||||
|
RUN apk add --no-cache --virtual .build-deps ca-certificates gcc linux-headers musl-dev jpeg-dev zlib-dev libffi-dev \
|
||||||
|
&& pip install --upgrade pip
|
||||||
|
|
||||||
|
COPY ./fet2020/requirements.txt /app/requirements.txt
|
||||||
|
|
||||||
|
RUN pip install -r requirements.txt
|
||||||
|
|
||||||
|
|
||||||
FROM tiangolo/uwsgi-nginx:python3.8-alpine
|
FROM tiangolo/uwsgi-nginx:python3.8-alpine
|
||||||
|
|
||||||
|
COPY --from=builder /opt/venv /opt/venv
|
||||||
|
|
||||||
|
# Make sure we use the virtualenv:
|
||||||
|
ENV PATH="/opt/venv/bin:$PATH"
|
||||||
|
|
||||||
COPY ./fet2020 /app
|
COPY ./fet2020 /app
|
||||||
|
|
||||||
#RUN apk add --no-cache --virtual .build-deps \
|
RUN python manage.py makemigrations && python manage.py makemigrations posts members
|
||||||
# ca-certificates gcc postgresql-dev linux-headers musl-dev \
|
|
||||||
# libffi-dev jpeg-dev zlib-dev
|
|
||||||
RUN apk add --no-cache --virtual .build-deps ca-certificates gcc linux-headers musl-dev jpeg-dev zlib-dev libffi-dev
|
|
||||||
|
|
||||||
RUN pip install --upgrade pip
|
|
||||||
RUN pip install -r requirements.txt
|
|
||||||
RUN python manage.py makemigrations
|
|
||||||
RUN python manage.py migrate
|
RUN python manage.py migrate
|
||||||
RUN apk del gcc .build-deps
|
|
||||||
|
|||||||
1
fet2020/.dockerignore
Normal file
1
fet2020/.dockerignore
Normal file
@@ -0,0 +1 @@
|
|||||||
|
.git/*
|
||||||
@@ -7,4 +7,5 @@ processes = 3
|
|||||||
module = fet2020.wsgi:application
|
module = fet2020.wsgi:application
|
||||||
pidfile=/tmp/project-master.pid
|
pidfile=/tmp/project-master.pid
|
||||||
enable-threads = true
|
enable-threads = true
|
||||||
|
venv=/opt/venv
|
||||||
socket=/tmp/app.sock
|
socket=/tmp/app.sock
|
||||||
4
run_container
Executable file
4
run_container
Executable file
@@ -0,0 +1,4 @@
|
|||||||
|
docker stop bb2
|
||||||
|
docker container rm bb2
|
||||||
|
docker build -t test1 .
|
||||||
|
docker run --name bb2 -d -p 8080:80 test1
|
||||||
Reference in New Issue
Block a user