Open NavyStack opened 1 month ago
If it aligns with the team's vision, we would be more than willing to contribute workflows for building Docker images as part of the project’s continuous integration setup. This could ensure that each Docker image build is consistent and tested, with any issues identified early in the pipeline.
Please let us know if this addition would be helpful, and we’d be glad to assist with implementing it in line with the team’s requirements.
Summary
This PR introduces a comprehensive Docker setup for the Notesium application, enabling easy deployment and consistent environment configuration. The setup includes multi-stage builds to optimise the final image size, security measures, and configuration scripts to handle user permissions and directory ownership dynamically.
Key Changes
Dockerfile Creation:
app-builder
stage, we install Go and Tailwind CSS, build the frontend, and compile the Go application.gosu
andtini
, enhancing security and enabling better process handling.Installation of Gosu and Tini:
Custom Entry Script:
start-docker.sh
notesium
user based on environment variables (UID
,GID
,USERNAME
). It adjusts existing users and groups where necessary to avoid conflicts and to ensure the specified user owns the required directories.NOTESIUM_DIR
data directory, checking if it exists and creating it if necessary. Ownership is set to match the specified user to ensure correct file permissions.Configuration of Persistent Data Storage:
/notesium/data
as a volume, making it easy to persist data outside of the container lifecycle.Default Entrypoint and Command:
ENTRYPOINT
is set totini
, usingstart-docker.sh
to configure permissions before switching to the non-root user.0.0.0.0:8080
.Considerations
gosu
, the application can drop root privileges post-initialisation, improving security. Additionally,tini
ensures proper process handling, preventing zombie processes.0.0.0.0
, making it accessible externally for testing or production use, and the port is dynamically set through environment variables.Test Plan
Coding Style Considerations
We’d like to acknowledge any potential deviations from the team’s coding conventions within this Docker setup and accompanying scripts. While aiming for a modular, readable, and secure configuration, we have prioritised clarity and maintainability throughout. However, we recognise that certain approaches, such as the handling of user permissions and ownership, may differ from the established house style.
Please feel free to highlight areas that may benefit from alignment with the team’s conventions. We’ll be happy to adjust any parts to better adhere to the team's stylistic preferences and ensure consistency across the project.