9
9
95506682020-09-07 10:41:31
Django
9550668, 2020-09-07 10:41:31

How to do a partial update of files on the server using Docker?

Good afternoon everyone.

Already asked a similar question and sent me to read docker guides. But I never figured it out.

I have a project, I upload it to the server, but in parallel, front-end developers work with the server and changes occur in the database, which is obvious.

I have a docker file:

# Base Image
FROM python:3.7

# create and set working directory
RUN mkdir /Test
WORKDIR /Test

# Add current directory code to working directory
ADD . /Test/

# set default environment variables
ENV PYTHONUNBUFFERED 1
ENV LANG C.UTF-8
ENV DEBIAN_FRONTEND=noninteractive

# set project environment variables
# grab these via Python's os.environ
# these are 100% optional here
ENV PORT=8888
#ENV DEBUG=0

# Install system dependencies
RUN pip3 install -r requirements.txt


# install environment dependencies
RUN pip3 install --upgrade pip
RUN pip3 install pipenv

# Install project dependencies
RUN pipenv install --skip-lock --system --dev

EXPOSE 8888
CMD gunicorn Test.wsgi:application --bind 0.0.0.0:$PORT


As I understand it, since we create the Test folder in the docker file and copy the entire Test project there, the db.sqlite3 file is overwritten every time. How to avoid this and how to upload it to the server correctly? Can you suggest?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sanes, 2020-09-07
@9550668

Docker must respect persistence. 99% of users forget about it.
Everything that needs to be updated or has dynamic and important data is taken out.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question