By creating the operating environment of Masonite, a Python web framework similar to Laravel, using Docker, we have made it available for joint development.
Mac: Catalina10.15.5 Docker: 19.03.8
Create a Dockerfile and data directory with the following contents in the working directory.
FROM ubuntu:latest
COPY ./requirements.txt /opt
RUN apt-get update && apt-get -y upgrade && \
apt-get install tzdata language-pack-ja gcc libgl1-mesa-glx libegl1-mesa libxrandr2 libxrandr2 libxss1 libxcursor1 libxcomposite1 libasound2 libxi6 libxtst6 wget -y && \
wget -P /opt https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh && \
bash /opt/Miniconda3-latest-Linux-x86_64.sh -b -p /opt/anaconda3 && \
rm /opt/Miniconda3-latest-Linux-x86_64.sh && \
echo "export PATH=/opt/anaconda3/bin:$PATH" >> ~/.bashrc && \
. ~/.bashrc && \
conda init && \
pip install -r /opt/requirements.txt
ENV TZ Asia/Tokyo
ENV LANG ja_JP.UTF-8
ENV LANGUAGE ja_JP:ja
ENV LC_ALL ja_JP.UTF-8
RUN rm /opt/requirements.txt
RUN mkdir /opt/myproject
Also, create the following requirements.txt.
masonite
At this stage, the directory structure is as follows.
.
├── Dockerfile
├── data
└── requirements.txt
Build the Docker image and start the container.
docker build . -t masonite
docker run -v $(pwd)/data:/opt/myproject -p 8000:8000 -it masonite /bin/bash
Go to the / opt / myproject directory and create a Masonite application.
cd /opt/myproject
craft new
Start the build-in server.
craft serve -h 0.0.0.0 -r
Also, when you want to start the Docker container again, move to / opt / myproject and start the following command.
craft install