This document specifies the containerization of the Timesheet application, which consists of:
- Python FastAPI backend
- Vue.js frontend
- SQLite database
- Build Stage:
node:20-bookwormfor frontend builds and dependency installation - Runtime Stage:
python:3.11-slim-bookwormfor the production environment
- Frontend Builder: Installs Node.js dependencies and builds the Vue.js application
- Backend Builder: Installs Python dependencies using uv
- Runtime: Production container with only necessary components and source code used to build the container
TIMESHEET_SQLITE: the location of the sqlite database fileTIMESHEET_SRC_HOME: the location of the application source code used to build the hosting containerTIMESHEET_SA_URL: E.g "sqlite:///data/timesheet.sqlite"
/data: Mount point for SQLite database file/app/static: Static files served by NGINX/app/src: Source code used to build the hosting container
Create a docker container to host the python fastapi, vue.js components and nginx proxy.
Select a suitable base image to host a stable version of python, including it's uv dependency management tool and the vue.js component.
Construct the container, to have a build stage. In the build stage compile python dependencies and the javascript/typescript dependencies. Compile the vue.js application.
Deploy the compiled application components into the hosting container.
The hosting container will host an NGINX proxy for the fastapi application and serve the vue.js application.
It is expected that the user will pass in a location for the sqlite database for the contained timesheet application to use. Otherwise the app should create a new database and use that inside the container. (A new database is especially useful for test runs.) Use configuration to place the database file in a convenient place to be mounted as a seperate volume.
Create a .github/workflows/build_hosting_container.sh script to orchestrate this process. Also create .github/workflows/docker-build.yml to build the container.
Create a Makefile in the root of the timesheet project. The Makefile will have the following targets for a local build.
docker: execute the build_hosting_container.sh script to build the host container (detect podman or docker tools to do this)run: use podman or docker to run the applicatin in the hosting containertest: use the hosting container to run the python unit/integration tests and the typescript component tests within the container.clean: remove the build and runtime containers and other artifactstest: Build the hostinc container and run the tests within the container.logs: Display the logs of the running containerstop: Stop the running containerstatus: Display the status of the running containerrestart: Restart the running containershell: Open a shell into the running containerexec: Execute a command in the running container