astro-paper
astro-paper copied to clipboard
Dockerfile added to build static files and serve with NGINX image
This PR includes a Dockerfile and .dockerignore that uses a two-stage build process: building static files with Node.js and serving them via a official NGINX image. The initial build stage uses node:lts to install dependencies and compile the application into static files. Second stage serve the static files with unprivileged NGINX Image.
Key Changes:
- Implemented multi-stage build to separate build and runtime environments.
- NGINX image for the runtime stage.
Build the Image by executing
docker build -t <image_name>:<image_tag> .
Run the Container by executing
docker run -p 8081:80 <image_name>:<image_tag>
The webpage should be accessible at http://localhost:8081
Hello @michealch Thanks for your contribution. When I try running this, I've got the following warning (although it is working as expected)
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
Do you know why this warning appears?
@satnaing fixed the issue by replacing the distroless image with official nginx unprivileged image. it should work fine now :)
The sample image is built for just sample purpose and only compatible with amd64.
@satnaing i will create another pull request to update readme and add the docker infos to it. Feel free to contact me, if you have any question regarding Docker or Container.
i have updated runtime image to official nginx image. Please merge the PR.