Skip to content

Commit

Permalink
fix: path mount which prevented built image from running
Browse files Browse the repository at this point in the history
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
  • Loading branch information
devraj committed Jun 20, 2023
1 parent 3966000 commit 3fc359b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
8 changes: 6 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ RUN apt-get update \

# Copy the files in the src directory which is the app package
# and the dependency matrix dedescribed by pyproject.toml
WORKDIR /opt/lab_mock
WORKDIR /opt
COPY ./src/. .

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

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

# There can only be one CMD argument
CMD []

# Labels are used to identify the image
LABEL org.opencontainers.image.source="https://github.com/anomaly/lab-python-mock-server"
LABEL org.opencontainers.image.description="A Python web server using Flask"
LABEL org.opencontainers.image.licenses="Apache-2.0"
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ services:
# In production this would be proxied through traefik
- "8000:80"
volumes:
- ./src/lab_mock:/opt/lab_mock
- ./src/:/opt/
networks:
default:
name: ${PROJ_NAME}-network
2 changes: 1 addition & 1 deletion src/lab_mock/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"""
__name__ = "lab_mock"
__version__ = "0.3.0"
__version__ = "0.5.0"

import os
from asgiref.wsgi import WsgiToAsgi
Expand Down

0 comments on commit 3fc359b

Please sign in to comment.