Skip to content

Commit e8cf286

Browse files
authored
feat: revamp python docker templates (#65)
* feat: revamp python setup * feat: update config * chore: upgrade python version to 3.11.5 to make conflict less * chore: update template configuration for flask * chore: update config for django apps * chore: update config for streamlit app * chore: update config for fastapi app * chore: update config to have main.py in python apps * feat: added python-pipenv for django, flask, fastapi, flask, streamlit
1 parent d93c418 commit e8cf286

11 files changed

+203
-468
lines changed

docker_config_generator/config.yaml

Lines changed: 130 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -228,118 +228,154 @@ templates:
228228
description: Start command for nodejs application
229229
default: npm run start
230230
django-pip:
231-
name: django-pip.Dockerfile
231+
name: python-pip.Dockerfile
232232
variables:
233-
DEPENDENCY_FILE:
233+
SETUP_COMMAND:
234234
type: string
235-
description: Dependency file for django
236-
default: requirements.txt
235+
description: Setup and install dependencies
236+
default: pip install -r requirements.txt
237237
START_COMMAND:
238238
type: string
239-
description: Start command [Include migrations as well]
240-
default: python manage.py makemigrations && python manage.py migrate && gunicorn <project_name>.wsgi:application --bind 0.0.0.0:80
241-
django-poetry:
242-
name: django-poetry.Dockerfile
239+
description: Start command for django app
240+
default: python manage.py makemigrations && python manage.py migrate && python manage.py runserver 0.0.0.0:8080
241+
django-pipenv:
242+
name: python-pipenv.Dockerfile
243243
variables:
244+
SETUP_COMMAND:
245+
type: string
246+
description: Setup and install dependencies
247+
default: pipenv install --dev --system --deploy
244248
START_COMMAND:
245249
type: string
246-
description: Start command [Include migrations as well]
247-
default: poetry run python manage.py makemigrations && poetry run python manage.py migrate && poetry run gunicorn <project_name>.wsgi:application --bind 0.0.0.0:80
250+
description: Start command for django app
251+
default: python manage.py makemigrations && python manage.py migrate && python manage.py runserver 0.0.0.0:8080
252+
django-poetry:
253+
name: python-poetry.Dockerfile
254+
variables:
248255
POETRY_VERSION:
249256
type: string
250257
description: Poetry version
251-
default: 1.4.2
258+
default: "1.4.2"
259+
SETUP_COMMAND:
260+
type: string
261+
description: Setup and install dependencies
262+
default: poetry install --no-interaction --no-cache
263+
START_COMMAND:
264+
type: string
265+
description: Start command for django app
266+
default: poetry run python manage.py makemigrations && poetry run python manage.py migrate && poetry run python manage.py runserver 0.0.0.0:8080
252267
flask-pip:
253-
name: flask-pip.Dockerfile
268+
name: python-pip.Dockerfile
254269
variables:
255-
PORT:
270+
SETUP_COMMAND:
256271
type: string
257-
description: Port for flask
258-
default: 80
272+
description: Setup and install dependencies
273+
default: pip install -r requirements.txt
259274
START_COMMAND:
260275
type: string
261-
description: Start command for flask
262-
default: python -m flask --app main run --host=0.0.0.0
263-
PEX_WRAPPER:
264-
type: string
265-
description: Pex Wrapper Name [Dont' modify]
266-
default: pex_wrapper
267-
flask-poetry:
268-
name: flask-poetry.Dockerfile
276+
description: Start command for flask app
277+
default: python main.py
278+
flask-pipenv:
279+
name: python-pipenv.Dockerfile
269280
variables:
270-
PORT:
281+
SETUP_COMMAND:
271282
type: string
272-
description: Port for flask
273-
default: 80
283+
description: Setup and install dependencies
284+
default: pipenv install --dev --system --deploy
274285
START_COMMAND:
275286
type: string
276-
description: Start command for flask
277-
default: poetry run flask --app main run --host=0.0.0.0
287+
description: Start command for flask app
288+
default: python main.py
289+
flask-poetry:
290+
name: python-poetry.Dockerfile
291+
variables:
278292
POETRY_VERSION:
279293
type: string
280294
description: Poetry version
281-
default: 1.4.2
282-
fastapi-poetry:
283-
name: fastapi-poetry.Dockerfile
284-
variables:
285-
PORT:
295+
default: "1.4.2"
296+
SETUP_COMMAND:
286297
type: string
287-
description: Port for fastapi
288-
default: 80
298+
description: Setup and install dependencies
299+
default: poetry install --no-interaction --no-cache
289300
START_COMMAND:
290301
type: string
291-
description: Start command for fastapi
292-
default: poetry run python -m uvicorn main:app --host=0.0.0.0
302+
description: Start command for flask app
303+
default: poetry run python main.py
304+
fastapi-poetry:
305+
name: python-poetry.Dockerfile
306+
variables:
293307
POETRY_VERSION:
294308
type: string
295309
description: Poetry version
296-
default: 1.4.2
310+
default: "1.4.2"
311+
SETUP_COMMAND:
312+
type: string
313+
description: Setup and install dependencies
314+
default: poetry install --no-interaction --no-cache
315+
START_COMMAND:
316+
type: string
317+
description: Start command for fastapi app
318+
default: poetry run uvicorn main:app --host 0.0.0.0 --port 8080 --workers 3
297319
fastapi-pip:
298-
name: fastapi-pip.Dockerfile
320+
name: python-pip.Dockerfile
299321
variables:
300-
PORT:
322+
SETUP_COMMAND:
301323
type: string
302-
description: Port for fastapi
303-
default: 80
324+
description: Setup and install dependencies
325+
default: pip install -r requirements.txt
304326
START_COMMAND:
305327
type: string
306-
description: Start command for fastapi
307-
default: python -m uvicorn main:app --host=0.0.0.0
308-
PEX_WRAPPER:
309-
type: string
310-
description: Pex Wrapper Name [Dont' modify]
311-
default: pex_wrapper
312-
streamlit-poetry:
313-
name: streamlit-poetry.Dockerfile
328+
description: Start command for streamlit app
329+
default: uvicorn main:app --host 0.0.0.0 --port 8080 --workers 3
330+
fastapi-pipenv:
331+
name: python-pipenv.Dockerfile
314332
variables:
315-
PORT:
333+
SETUP_COMMAND:
316334
type: string
317-
description: Port for streamlit
318-
default: 80
335+
description: Setup and install dependencies
336+
default: pipenv install --dev --system --deploy
319337
START_COMMAND:
320338
type: string
321-
description: Start command for streamlit
322-
default: poetry run streamlit run main.py --server.port $PORT
339+
description: Start command for streamlit app
340+
default: uvicorn main:app --host 0.0.0.0 --port 8080 --workers 3
341+
streamlit-poetry:
342+
name: python-poetry.Dockerfile
343+
variables:
323344
POETRY_VERSION:
324345
type: string
325346
description: Poetry version
326-
default: 1.4.2
347+
default: "1.4.2"
348+
SETUP_COMMAND:
349+
type: string
350+
description: Setup and install dependencies
351+
default: poetry install --no-interaction --no-cache
352+
START_COMMAND:
353+
type: string
354+
description: Start command for streamlit app
355+
default: poetry run streamlit run main.py --server.port 8080
327356
streamlit-pip:
328-
name: streamlit-pip.Dockerfile
357+
name: python-pip.Dockerfile
329358
variables:
330-
PORT:
359+
SETUP_COMMAND:
331360
type: string
332-
description: Port for streamlit
333-
default: 80
361+
description: Setup and install dependencies
362+
default: pip install -r requirements.txt
334363
START_COMMAND:
335364
type: string
336-
description: Start command for streamlit
337-
default: streamlit run main.py --server.port $PORT
338-
PEX_WRAPPER:
365+
description: Start command for streamlit app
366+
default: streamlit run main.py --server.port 8080
367+
streamlit-pipenv:
368+
name: python-pipenv.Dockerfile
369+
variables:
370+
SETUP_COMMAND:
371+
type: string
372+
description: Setup and install dependencies
373+
default: pipenv install --dev --system --deploy
374+
START_COMMAND:
339375
type: string
340-
description: Pex Wrapper Name [Dont' modify]
341-
default: pex_wrapper
342-
376+
description: Start command for streamlit app
377+
default: streamlit run main.py --server.port 8080
378+
343379
identifiers:
344380
nextjs:
345381
- selector:
@@ -374,6 +410,15 @@ identifiers:
374410
- file: requirements.txt
375411
keywords:
376412
- flask
413+
flask-pipenv:
414+
- selector:
415+
- file: Pipfile
416+
keywords:
417+
- Flask
418+
- selector:
419+
- file: Pipfile
420+
keywords:
421+
- flask
377422
- selector:
378423
- file: Pipfile.lock
379424
keywords:
@@ -408,6 +453,15 @@ identifiers:
408453
- file: requirements.txt
409454
keywords:
410455
- django
456+
django-pipenv:
457+
- selector:
458+
- file: Pipfile
459+
keywords:
460+
- Django
461+
- selector:
462+
- file: Pipfile
463+
keywords:
464+
- django
411465
- selector:
412466
- file: Pipfile.lock
413467
keywords:
@@ -438,6 +492,11 @@ identifiers:
438492
- file: requirements.txt
439493
keywords:
440494
- fastapi
495+
fastapi-pipenv:
496+
- selector:
497+
- file: Pipfile
498+
keywords:
499+
- fastapi
441500
- selector:
442501
- file: Pipfile.lock
443502
keywords:
@@ -456,6 +515,11 @@ identifiers:
456515
- file: requirements.txt
457516
keywords:
458517
- streamlit
518+
streamlit-pipenv:
519+
- selector:
520+
- file: Pipfile
521+
keywords:
522+
- streamlit
459523
- selector:
460524
- file: Pipfile.lock
461525
keywords:

docker_config_generator/templates/django-pip.Dockerfile

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

docker_config_generator/templates/django-poetry.Dockerfile

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

0 commit comments

Comments
 (0)