Deployment with DevSpace
Deploy Project
Run the local deployment pipeline using this command:
devspace deploy
Running devspace deploy
will do the following:
- Build the Dockerfile(s) specified in the
images
section of thedevspace.yaml
- Tag the resulting image(s) with an auto-generated tag according to a customizable tag schema
- Push the resulting Docker images to the specified registries
- Create image pull secrets in your Kubernetes namespace (optional, enabled by default)
- Deploy everything that is defined within the
deployments
section in thedevspace.yaml
If you only want to build, tag and push all images but not deploy anything, run:
devspace build
Deploy to Production
As shown earlier, DevSpace is by default configured to override your ENTRYPOINT
to restart your application after files are synchronized into the container. However, in production, we don't want DevSpace to change anything about our Docker image. That's why you see the following section in your devspace.yaml:
profiles:
- name: production # Name of this profile: production
patches: # Patches to change the config for this profile
- op: remove # A patch to remove the injectResartHelper option
path: images.app.injectRestartHelper
- op: remove # Second patch ONLY for multi-stage builds
path: images.app.build.docker.options.target # Remote the build target to build entire Dockerfile
Profiles allow you to modify the config for certain use cases or deployment environment (e.g. your production cluster). You can print the config after applying all patches of this profile using this command:
devspace print -p production
The flag -p / --profile
is a global flag, so we can also use it to apply this profile during the deployment process:
devspace deploy -p production
Learn more about integrating DevSpace into your CI/CD pipelines.