Deployment · By Rivtor · Updated
Deploy a Dockerized full-stack application
A Dockerfile defines how a service builds and starts. It does not automatically define database lifecycle, migration safety, public routing or the configuration expected by another service.
See the Rivtor deployment workflow →
Make the image reproducible
Commit dependency locks and copy only files the build needs. Exclude local dependencies, Git history and secrets from the build context. Deleting a copied secret in a later layer does not necessarily remove it from the image history. Inspect the final runtime stage.
Start a production process
Launch the application in the foreground with an explicit command. Bind to the configured port and a reachable interface. Avoid development servers that silently choose another free port. Confirm whether the process needs writable scratch space rather than assuming the filesystem is durable.
Separate services and state
Give frontend and API services their own contexts when appropriate. Keep Postgres outside the application container and use environment-based connection configuration. A database binary inside a web image is not a persistence, backup or recovery strategy.
Verify more than container startup
Build the image locally with synthetic configuration, then check the deployed hostname, routes and health response. Reverse-proxy prefixes can affect redirects and asset paths. Inspect a normal user journey and persistence separately from the process health indicator.
Command reference
docker build -t my-app .
docker run --rm -p 3000:3000 my-app
These commands illustrate the documented workflow. Replace example addresses and identifiers with your own. Deployment and migration commands affect the selected project; confirm the target before running them.
Build context and runtime are separate concerns
A monorepo Docker build can fail because the build context excludes a shared package, even though the Dockerfile path is correct. Confirm which directory is sent to the builder and which files COPY can access. A .dockerignore should exclude secrets, dependency directories and unrelated build output without removing required manifests.
Use a multi-stage build where appropriate and ensure the final image includes production dependencies, the compiled application and a suitable runtime user. EXPOSE documents a port; it does not make the application listen on that port.
Exercise the container locally
docker build -t example-api ./api
docker run --rm --env-file ./api/.env.local -p 8000:8000 example-api
The env file in this example is local and private. Supply your own disposable test configuration and never bake it into the image. Check the configured listener before interpreting an unreachable port as a routing issue.
A successful build does not demonstrate database persistence. Replace the container, reconnect to the intended data service and confirm a synthetic record survives. Keep uploads outside an ephemeral application filesystem when they need to persist across releases.
Translate orchestration requirements deliberately
Multiple services need explicit start commands, addresses and lifecycle expectations. A Dockerfile is not a promise that every Compose setting is supported unchanged. Review framework detection, data services and the application architecture guide.
Source: Docker build practices.
Next steps
Read the Rivtor reference for supported configuration and limitations, and use the deployment quickstart when trying Rivtor for the first time. Validate workflows with synthetic data before connecting valuable production records.