Server deployment containers for different frameworks
These container images are not "final". They serve as a base to start out and in most cases work as-is with your project for quick testing.
Please read the Docker documentation and set up certificates before deploying these containers.
Version: lastest release of framework where the deployment was tested. It might require modifications in later versions.
Framework | Version | Stages | Tags |
---|---|---|---|
Angular | v13.3 |
2 | angular , nginx , nodejs , ts , html , yarn , npm , npx |
Apache | v2.4 |
1 | apache , static , html , css , php , js |
DotNET | v6.0 |
2 | dotnet , c# , nuget , core |
FastAPI | v3.10 |
1 | python , python3 , pip , fastapi , uvicorn |
Go | v1.18.2 |
2 | go , golang , mux , alpine |
Laravel | v9.1.8 |
1 | php , laravel , artisan , composer , npm |
Nginx | v1.21 |
1 | nginx , js , static , html , css |
NodeJS | v16.15.0 LTS |
1 | nodejs , js , yarn , npm , npx , pnpm , pm2 |
React | v18.1.0 |
2 | react , nginx , nodejs , js , html , yarn , npm , npx |
Each deployment has the following structure. You may not need all the files.
/name
/Dockerfile
- Commands to build a container/.dockerignore
- List of files and folders not to copy into the container/compose.yml
- Instructions for docker-compose on how to host the container(s)
Move the Dockerfile
and .dockerignore
files into your project root.
Update .dockerignore
to ignore everything you will not need for your deployment. Ideally, you should ignore:
- Everything that's in your
.gitignore
- Git folder (
.git/
) - Build files and binaries
- Caches
- Installed packages
- Tests (and their config)
- Logs
- Readme files and licenses
- IDE specific files
- Docker specific files
- etc...
As a rule of thumb, consider every file you deploy to be accessible for attackers in a breach, so remove all secret information, even after running the application (like a .env
file with login details).
Check if the current Dockerfile settings work with your project. Some Dockerfiles contain multiple methods for package management. Checklist:
- Exposed ports
- Package manager
- Included necessary files
- Correct entry point
Build the container with the given name and tag. The tag can be a version or a subtype of your project, like wip
.
This command may require you to have administrator privileges
docker build -t <name>:<tag> .
Run the container and expose the given ports. Docker can forward those ports to another external one.
This command may require you to have administrator privileges
docker run -p<port_ext>:<port_int> <name>:<tag>
Test the container to see if it's working and available from your browser.
Deploy to the provider of your choice. This step may be different for each provider, so seek further instruction in their documentation.
Each deployment also contains a docker-compose description YAML file (compose.yml
). For local usage or quick startup you may use it like so:
Build container:
docker-compose build
Start container:
docker-compose up
Build then start each time:
docker-compose up --build
General MIT license: view