Skip to content

Commit 3fc359b

Browse files
committed
fix: path mount which prevented built image from running
the path in docker-compose explicitly mounted /src/lab_mock to /opt/lab_mock which would have overwritten what would essentially be a bug in the build step where the files from /src/lab_mock are being copied into /opt/lab_mock/lab_mock failing the uvicorn command to find the files when the image is built and pushed to the github repository we should maintain this image constantly so we can test these simple use cases this also follows some docker build issues we have had in the past, while these commands have been documented into tickets anomaly/lab-python-server#43 we should make them part of the build process and Taskfile
1 parent 3966000 commit 3fc359b

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

Dockerfile

+6-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ RUN apt-get update \
1818

1919
# Copy the files in the src directory which is the app package
2020
# and the dependency matrix dedescribed by pyproject.toml
21-
WORKDIR /opt/lab_mock
21+
WORKDIR /opt
2222
COPY ./src/. .
2323

2424
# Ask poetry to install all packages including the app
@@ -31,8 +31,12 @@ RUN poetry install --no-root
3131

3232
# The app package will be located in /opt/appname so run
3333
# uvicorn at this level so it sees the package
34-
WORKDIR /opt/
3534
ENTRYPOINT ["uvicorn", "lab_mock:app", "--host=0.0.0.0", "--port=80", "--reload"]
3635

3736
# There can only be one CMD argument
3837
CMD []
38+
39+
# Labels are used to identify the image
40+
LABEL org.opencontainers.image.source="https://github.com/anomaly/lab-python-mock-server"
41+
LABEL org.opencontainers.image.description="A Python web server using Flask"
42+
LABEL org.opencontainers.image.licenses="Apache-2.0"

docker-compose.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ services:
2929
# In production this would be proxied through traefik
3030
- "8000:80"
3131
volumes:
32-
- ./src/lab_mock:/opt/lab_mock
32+
- ./src/:/opt/
3333
networks:
3434
default:
3535
name: ${PROJ_NAME}-network

src/lab_mock/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
1515
"""
1616
__name__ = "lab_mock"
17-
__version__ = "0.3.0"
17+
__version__ = "0.5.0"
1818

1919
import os
2020
from asgiref.wsgi import WsgiToAsgi

0 commit comments

Comments
 (0)