2023-12-04 22:06:17 +08:00
|
|
|
ARG DOCKER_PLATFORM=$TARGETPLATFORM
|
|
|
|
FROM --platform=$DOCKER_PLATFORM python:3.11.4-bookworm
|
2023-12-03 00:08:10 +08:00
|
|
|
|
|
|
|
ENV PYTHONBUFFERED 1
|
|
|
|
|
|
|
|
# Create directory
|
|
|
|
RUN mkdir /code
|
|
|
|
|
|
|
|
# Set the working directory to /code
|
|
|
|
WORKDIR /code
|
|
|
|
|
|
|
|
# Mirror the current directory to the working directory for hotreloading
|
|
|
|
ADD . /code/
|
|
|
|
|
|
|
|
# Install pipenv
|
2023-12-03 00:43:50 +08:00
|
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
2023-12-03 00:08:10 +08:00
|
|
|
|
|
|
|
# Make migrations
|
|
|
|
RUN python equipment_tracker/manage.py makemigrations
|
|
|
|
|
|
|
|
# Run custom migrate
|
|
|
|
RUN python equipment_tracker/manage.py migrate
|
|
|
|
|
|
|
|
# Generate DRF Spectacular Documentation
|
2023-12-03 00:43:50 +08:00
|
|
|
RUN python equipment_tracker/manage.py spectacular --color --file equipment_tracker/schema.yml
|
2023-12-03 00:08:10 +08:00
|
|
|
|
|
|
|
# Expose port 8000 for the web server
|
|
|
|
EXPOSE 8000
|