Skip to content

Commit 31cce71

Browse files
authored
πŸ“ Finish removing requirements stuff (#360)
* Create list of removed packages * Removed useless commented out line * Remove unecessary file * Change migration section, rm requirements upgrade * Fix title for migration section * Clarify which Dockerfile to change for updates
1 parent 0b1c778 commit 31cce71

File tree

5 files changed

+35
-81
lines changed

5 files changed

+35
-81
lines changed

β€ŽDockerfileβ€Ž

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ RUN apt-get update && apt-get upgrade -y \
88
&& useradd -u 1000 -ms /bin/bash -d /home/python python \
99
&& mkdir -p /python && chown python:nogroup /python
1010

11-
#RUN pip install uvicorn==0.17.6
1211
# Copy the needed files
1312
COPY entrypoint.sh test_suite.sh /python/
1413

β€ŽREADME.mdβ€Ž

Lines changed: 18 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -15,25 +15,20 @@ one of 3 cases based on the parameter you pass in:
1515
2. `./dev.sh run` runs the main application.
1616
3. `./dev.sh cli` drops you into the cli for the image
1717

18-
## :hourglass_flowing_sand: Migration to version 4
19-
20-
The version 4 comes with significant changes:
21-
22-
* The docker base image was changed from alpine to slim buster
23-
* All the `apk add` commands need to be replaced with equivalent `apt-get` commands
24-
* slim buster has more base packages such as bash so probably less installation
25-
of system packages is needed
26-
* The entrypoint now provides standard commands to run and test the webapp
27-
* No `CMD` is necessary for production as `startapp` is the default
28-
* In development, run the `developapp` command
29-
* See below for testing
30-
* A `config.sh` is expected where environment variables for configuration purposes
31-
can be defined
32-
* The `requirements.txt` has been reduced to the base and development python packages
33-
* Base packages such as FastAPI, pydantic, loguru, ...
34-
* Development pacakages such as watchmedo, pytest, mypy, ...
35-
* Therefore you need to add to your requirements file packages such as pandas
36-
that were included in this image in versions prior to 4
18+
## :hourglass_flowing_sand: Migration from version 202205 to above
19+
20+
Starting with the version 202207, the docker python base does not contain
21+
any preinstalled python packages. It is now just providing a folder structure
22+
with adequate permissions for the python user, and a standard test suite.
23+
24+
As a consequence upgrading to version 202207 and latest requires to
25+
add the packages that used to be provided by the docker python base image.
26+
The list of packages in listed in the
27+
[removed-packages.txt](./removed-packages.txt) file.
28+
29+
The docker python base test image uses now poetry as it is the preferred
30+
way to manage dependencies at Satel. It can be used as an example
31+
on how to use poetry while building a python app image.
3732

3833
## :open_file_folder: Folder structure
3934

@@ -51,19 +46,11 @@ such as the `entrypoint.sh`. Then the subfolders organize the app files:
5146

5247
1. Go to docker hub to get the latest patch version for
5348
the [python docker image](https://hub.docker.com/_/python/)
54-
2. Then 3 files need to be edited with the latest python minor or patch versions:
55-
1. `docker-compose.generate_requirements.yml` to generate the requirements files.
49+
2. Then 2 files need to be edited with the latest python minor or patch versions:
5650
1. `.github/workflows/docker_image.yml` to build and push the right images to docker hub.
57-
1. `Dockerfile` to change the default base image version. This is used only for testing
58-
while developing but better to keep it up to date.
59-
60-
### Upgrade the requirements files
61-
62-
Rather simple. Just run the following command at the root of the repo:
63-
64-
```bash
65-
docker-compose -f docker-compose.generate_requirements.yml up
66-
```
51+
1. `Dockerfile` at the root (not the one in `/tests`) to change the default
52+
base image version. This is used only for testing while developing but
53+
better to keep it up to date.
6754

6855
## :keyboard: Commands
6956

β€Ždocker-compose.generate_requirements.ymlβ€Ž

Lines changed: 0 additions & 26 deletions
This file was deleted.

β€Žgenerate_requirements.shβ€Ž

Lines changed: 0 additions & 23 deletions
This file was deleted.

β€Žremoved-packages.txtβ€Ž

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
fastapi
2+
uvicorn
3+
loguru
4+
# Dev dependencies below
5+
watchdog pyyaml argh
6+
mypy mypy-extensions
7+
pytest pytest-cov
8+
pytest-mock
9+
pytest-asyncio
10+
nest-asyncio
11+
flake8
12+
isort
13+
flake8-isort
14+
flake8-quotes
15+
flake8-print
16+
black
17+
interrogate

0 commit comments

Comments
Β (0)