lowryel / Django-E-Commerce

School Homework Project

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

E-Commerce Project For Baby Tools

TECHNOLOGIES

  • Python
  • Django
  • Venv

Photos

Home Page with login

Home Page with filter

Product Detail Page

Home Page with no login

Register Page

Login Page

FROM python:3.10-slim-buster as Builder

Setting environment variables. (Good Practice)

ENV PYTHONDONTWRITEBYTECODE 1 ENV PYTHONUNBUFFERED 1

Set the current working directory

WORKDIR /app

RUN python -m venv /opt/venv ENV PATH="/opt/venv/bin:$PATH"

ENV PATH="/usr/bin/python3:$PATH"

RUN mkdir -p /app/pip_cache

Copy the django project

COPY /babyshop_app/ /app/

upgrade pip to latest version

RUN pip install --upgrade pip

RUN pip install -r requirements.txt --cache-dir /app/pip_cache

Running a multi-stage build to reduce the final image size

FROM python:3.10-alpine

Working dir for stage 2

WORKDIR /babyshop-app

ENV PATH="/opt/venv/bin:$PATH"

Copy requirements file from local app directory

COPY --from=Builder /app/ /babyshop-app/

RUN ls /babyshop-app

upgrade pip to latest version

RUN pip install --upgrade pip

Assign user to the directory

RUN useradd -ms /bin/bash www-data

USER www-data

Install dependencies

RUN pip install -r requirements.txt

Expose the necessary port for action

EXPOSE 8000

Set the start up command

CMD [ "python3 manage.py makemigrations", "python3 manage.py migrate", "python3 manage.py runserver" ]

About

School Homework Project

License:MIT License


Languages

Language:Python 65.2%Language:HTML 30.5%Language:Dockerfile 3.1%Language:Shell 1.2%