diff --git a/.dockerignore b/.dockerignore index 9ca5748..a3eada7 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,29 +1,13 @@ -# Ignore Python cache files +.git __pycache__ *.pyc *.pyo - -# Ignore Git files -.git -.gitignore - -# Ignore Dockerfile and .dockerignore -Dockerfile -.dockerignore - -# Ignore local configuration files -*.local +*.pyd +*.db +*.sqlite *.log - -# Ignore unit test and coverage results -*.coverage -.coverage -.coverage.* - -# Ignore pytest cache -.pytest_cache - -# Ignore build artifacts -build/ -dist/ -*.egg-info/ +.env.local +.DS_Store +node_modules +build +dist diff --git a/Dockerfile b/Dockerfile index 7d3aedd..c9619c9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,17 +1,32 @@ -FROM python:3.8-slim +FROM python:3.8-alpine AS build WORKDIR /app -COPY . /app - -RUN pip install --upgrade pip \ - && pip install pipenv +RUN apk add --no-cache --virtual .build-deps \ + build-base linux-headers gcc musl-dev libffi-dev postgresql-dev libpq && \ + pip install --upgrade pip && \ + pip install pipenv +COPY Pipfile Pipfile.lock ./ RUN PIPENV_VENV_IN_PROJECT=1 pipenv install --deploy --ignore-pipfile -COPY .env /app/.env +COPY . . + +FROM python:3.8-alpine + +WORKDIR /app + +RUN apk add --no-cache libpq && \ + pip install --upgrade pip && \ + pip install pipenv + +COPY --from=build /app /app ENV PIPENV_VENV_IN_PROJECT=1 ENV PATH="/app/.venv/bin:$PATH" +COPY .env /app/.env + +EXPOSE 5000 + CMD ["pipenv", "run", "python", "src/main.py"] diff --git a/Pipfile b/Pipfile index 1bb2e22..0f00e51 100644 --- a/Pipfile +++ b/Pipfile @@ -25,5 +25,3 @@ python_version = "3.8" [scripts] start = "python src/main.py" -test = "# To implement" -lint = "# To implement" diff --git a/Pipfile.lock b/Pipfile.lock index 37999fe..77d8cf6 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -55,11 +55,11 @@ }, "certifi": { "hashes": [ - "sha256:3cd43f1c6fa7dedc5899d69d3ad0398fd018ad1a17fba83ddaf78aa46c747516", - "sha256:ddc6c8ce995e6987e7faf5e3f1b02b302836a0e5d98ece18392cb1a36c72ad56" + "sha256:5a1e7645bc0ec61a09e26c36f6106dd4cf40c6db3a1fb6352b0244e7fb057c7b", + "sha256:c198e21b1289c2ab85ee4e67bb4b4ef3ead0892059901a8d5b622f24a1101e90" ], "markers": "python_version >= '3.6'", - "version": "==2024.6.2" + "version": "==2024.7.4" }, "cfgv": { "hashes": [