Prerequisites
- Qovery CLI installed
- Code hosted on GitHub
- Basic understanding of Docker concepts
Overview
The tutorial recommends creating both a Dockerfile at the project root and a .dockerignore file to exclude unnecessary files from your image.Dockerfile Instructions
FROM - Base Image
The first line you’ll add in your Dockerfile is FROM. This pulls an existing image from Docker Hub matching your application language:WORKDIR - Working Directory
Sets the working directory within the container:COPY - Copy Source Code
Copies your source code into the image:RUN - Execute Commands
Executes commands for installing dependencies and building applications:- Python
- Node.js
- Go
- Java
EXPOSE - Open Ports
Opens ports for external access:- Node.js/Express
- Python/Flask
- Go
CMD - Execute Application
Specifies how to execute the application:- Python
- Node.js
- Go
- Java
Complete Dockerfile Examples
Python Flask Application
Node.js Express Application
Multi-stage Go Application
.dockerignore File
Create a.dockerignore file to exclude unnecessary files:
Building Your Image
Local Testing
Test your Docker image locally:Testing with Qovery CLI
Test with Qovery CLI before deploying:Best Practices
Minimize layer count
Minimize layer count
Combine RUN commands when possible:
Use multi-stage builds
Use multi-stage builds
Reduce final image size by separating build and runtime stages:
Leverage build cache
Leverage build cache
Copy dependency files before source code:
Use .dockerignore
Use .dockerignore
Always create a
.dockerignore file to exclude unnecessary files from your build context.What’s Next
Once your Dockerfile is ready, you can deploy your application to Qovery:Deploy Your First Application
Step-by-step deployment guide
Application Configuration
Configure your application settings
Environment Variables
Manage environment variables
Ports Configuration
Configure application ports