diff --git a/backend/Dockerfile b/backend/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..2bf67b80acabca706b87cbf3a550423a1769ae4e --- /dev/null +++ b/backend/Dockerfile @@ -0,0 +1,23 @@ +FROM python:3.9 AS build + +## virtualenv +RUN python3 -m venv /venv +ENV PATH="/venv/bin:$PATH" + +## add and install requirements +RUN pip install --upgrade pip && pip install pip-tools +COPY ./requirements.txt ./ +RUN pip install -r requirements.txt + + + +FROM python:3.9 AS runtime + +EXPOSE 80 +ENV PATH="/venv/bin:$PATH" + +COPY --from=build /venv /venv +WORKDIR /backend +COPY . . + +ENTRYPOINT ["python3", "main.py"] \ No newline at end of file diff --git a/backend/docker-compose.yml b/backend/docker-compose.yml index abb808ef2f917286858187652be7bb418806633c..055a16770c91f76503cf15b69ec08f10956d36b7 100644 --- a/backend/docker-compose.yml +++ b/backend/docker-compose.yml @@ -8,4 +8,18 @@ services: env_file: .env command: ["mysqld", "--authentication-policy=mysql_native_password"] ports: - - "3306:3306" \ No newline at end of file + - "3306:3306" + + app: + container_name: "app" + build: . + depends_on: + - db + restart: always + ports: + - 8000:80 + env_file: .env + environment: + DB_HOST: db + links: + - db \ No newline at end of file diff --git a/backend/requirements.txt b/backend/requirements.txt index c5e51aa9fca602b3823b860a68bd42baebf22daa..dd60603d49144d4cd3f0f7f746dac26fee7670ee 100644 --- a/backend/requirements.txt +++ b/backend/requirements.txt @@ -12,3 +12,6 @@ sniffio==1.2.0 starlette==0.19.1 typing-extensions==4.2.0 uvicorn==0.17.6 +SQLAlchemy==1.4.19 +python-dotenv==0.18.0 +PyMySQL==1.0.2 \ No newline at end of file