[image] build update

This commit is contained in:
doman 2023-09-03 16:04:13 +02:00
parent 2ba966c608
commit 43049dcf2b
3 changed files with 36 additions and 6 deletions

View file

@ -1,13 +1,32 @@
from python
# builder
FROM python:3.11.5-bullseye as builder
RUN mkdir /opt/fooder
WORKDIR /opt/fooder
RUN pip install setuptools
COPY fooder /opt/fooder/fooder
COPY setup.py /opt/fooder/setup.py
RUN python /opt/fooder/setup.py sdist
RUN mv /opt/fooder/dist/FooderApi*.tar.gz /opt/fooder/dist/fooder.tar.gz
# final image
FROM python:3.11.5-bullseye
RUN apt-get -y install libpq-dev
COPY requirements.txt requirements.txt
RUN pip install -r requirements.txt
RUN mkdir /opt/fooder
RUN useradd fooder
RUN mkdir /opt/fooder && chown fooder:fooder /opt/fooder
WORKDIR /opt/fooder
COPY fooder /opt/fooder/fooder
COPY --from=builder /opt/fooder/dist/fooder.tar.gz /opt/fooder/fooder.tar.gz
RUN pip install fooder.tar.gz
RUN rm fooder.tar.gz
CMD ["uvicorn", "fooder.app:app", "--host", "0.0.0.0", "--port", "8000"]

View file

@ -23,8 +23,5 @@ services:
- fooder
env_file:
- .env
volumes:
- ./fooder:/opt/fooder/fooder
ports:
- "8000:8000"
command: "uvicorn fooder.app:app --host 0.0.0.0 --port 8000 --reload"

14
setup.py Normal file
View file

@ -0,0 +1,14 @@
from setuptools import setup, find_packages
version = "0.0.1"
setup(
name="FooderApi",
version=version,
description="FooderApi",
url="http://fooderapi.domandoman.xyz",
author="Doman ICKYICKY",
license="MIT",
packages=find_packages(),
zip_safe=False,
)