Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Michele del Giudice
DevOps Tests
Commits
b749455b
Commit
b749455b
authored
Nov 17, 2025
by
Michele Del Giudice
Browse files
Guvicorn & Tests
parent
b0e07009
Changes
3
Hide whitespace changes
Inline
Side-by-side
Dockerfile
→
Dockerfile
.uvicorn
View file @
b749455b
...
@@ -13,12 +13,12 @@ RUN apt-get update && \
...
@@ -13,12 +13,12 @@ RUN apt-get update && \
COPY requirements.txt ./
COPY requirements.txt ./
RUN pip install --upgrade pip && \
RUN pip install --upgrade pip && \
pip
install
--no-cache-dir
-r
requirements.txt
pip install --no-cache-dir -r requirements.txt && \
pip install gunicorn
# Copy application
# Copy application
COPY . /app
COPY . /app
ENV
FLASK_APP=app:create_app
EXPOSE 5000
EXPOSE 5000
# Healthcheck: call the Flask /health endpoint
# Healthcheck: call the Flask /health endpoint
...
@@ -26,4 +26,4 @@ HEALTHCHECK --interval=30s --timeout=5s --start-period=5s --retries=3 \
...
@@ -26,4 +26,4 @@ HEALTHCHECK --interval=30s --timeout=5s --start-period=5s --retries=3 \
CMD curl -fS http://127.0.0.1:5000/health || exit 1
CMD curl -fS http://127.0.0.1:5000/health || exit 1
# Use gunicorn and call the factory to create the app
# Use gunicorn and call the factory to create the app
CMD
["gunicorn", "-b", "0.0.0.0:5000", "app:
create_
app
()
"]
CMD ["gunicorn", "-b", "0.0.0.0:5000", "app:app"]
tests/__pycache__/test_api.cpython-313-pytest-9.0.1.pyc
View file @
b749455b
No preview for this file type
tests/test_api.py
View file @
b749455b
...
@@ -3,13 +3,13 @@ from datetime import datetime, timedelta
...
@@ -3,13 +3,13 @@ from datetime import datetime, timedelta
import
pytest
import
pytest
from
app
import
create
_app
from
app
import
app
as
flask
_app
from
models
import
db
,
Car
from
models
import
db
,
Car
@
pytest
.
fixture
@
pytest
.
fixture
def
app
():
def
app
():
app
=
create
_app
()
app
=
flask
_app
app
.
config
.
update
({
app
.
config
.
update
({
'TESTING'
:
True
,
'TESTING'
:
True
,
# Use in-memory SQLite for tests
# Use in-memory SQLite for tests
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment