You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[black](https://black.readthedocs.io/en/stable/) |  | ready to use | black application image (useful for CI)
69
70
[gray](https://github.com/dizballanze/gray) |  | ready to use | gray application image (useful for CI)
70
71
[ruff](https://github.com/astral-sh/ruff) |  | ready to use | ruff linter image (useful for CI)
72
+
[uv](https://github.com/astral-sh/uv) |  | ready to use | An extremely fast Python package and project manager (useful for CI)
71
73
[jupyterlab](https://github.com/jupyterlab/jupyterlab) |  | ready to use | jupyterlab image
72
74
base |  | | common layers
73
75
74
76
75
77
Concept
76
78
-------
77
79
78
-
The main idea of this method is to build a `virtualenv` for your package using
79
-
heavy full-powered image (e.g. `ghcr.io/snakepacker/python:all`, that contains all
80
-
necessary headers, libraries, compiler, etc.), and then copy it into thin
80
+
The main idea of this method is to build a `virtualenv` for your package using
81
+
heavy full-powered image (e.g. `ghcr.io/snakepacker/python:all`, that contains all
82
+
necessary headers, libraries, compiler, etc.), and then copy it into thin
81
83
`base image` with suitable Python version.
82
84
83
85
Reasons
84
86
-------
85
87
86
-
Why so complex? You could just `COPY` directory with your python project into
87
-
Docker container, and for the first point of view this seems to be reasonable.
88
+
Why so complex? You could just `COPY` directory with your python project into
89
+
Docker container, and for the first point of view this seems to be reasonable.
88
90
89
91
But just copying directory with python project cause several problems:
90
92
91
-
- Generated on different operating system .pyc files can be put into Docker
92
-
image accidentally. Thus, python would try to rewrite .pyc with correct ones
93
-
each time when Docker image would be started. If you would run Docker image
94
-
in read-only mode - your application would break.
95
-
96
-
- Large possibility that you would also pack garbage files: pytest and tox
97
-
cache, developer's virtualenv and other files, that just increate the size of
93
+
- Generated on different operating system .pyc files can be put into Docker
94
+
image accidentally. Thus, python would try to rewrite .pyc with correct ones
95
+
each time when Docker image would be started. If you would run Docker image
96
+
in read-only mode - your application would break.
97
+
98
+
- Large possibility that you would also pack garbage files: pytest and tox
99
+
cache, developer's virtualenv and other files, that just increate the size of
98
100
the resulting image.
99
101
100
-
- No explicit entrypoint. It is not obvious what commands end user is able to
102
+
- No explicit entrypoint. It is not obvious what commands end user is able to
101
103
run (we hope you've implemented `-h` or `--help` arguments).
102
-
103
-
- By default, tox interprets your package as python module, e.g. it tries to
104
+
105
+
- By default, tox interprets your package as python module, e.g. it tries to
104
106
run `pip install .` when preparing environment.
105
107
106
108
Yes, of course, you can solve all of those problems using hacks, specific
107
-
settings, .dockeridnore file, and other tricks. But it would be non-intuitive
109
+
settings, .dockeridnore file, and other tricks. But it would be non-intuitive
108
110
and non-obvious for your users.
109
111
110
-
So, we recommend to spend a little more time and pack your package carefully,
112
+
So, we recommend to spend a little more time and pack your package carefully,
111
113
so your users would run it with pleasure.
112
114
113
115
Example
114
116
-------
115
117
116
-
For example, you may build the `jupyter notebook`. Just create a Dockerfile
118
+
For example, you may build the `jupyter notebook`. Just create a Dockerfile
117
119
with the following content:
118
120
119
121
```Dockerfile
@@ -168,7 +170,7 @@ All images contain ready to use and simple wrappers for easy image building.
168
170
169
171
Pretty simple bash script. The main purpose is removing the apt cache and temporary files after installation when you want to install something through apt-get install.
0 commit comments