How to Deploy from Container Images
App Platform is a Platform-as-a-Service (PaaS) offering that allows developers to publish code directly to DigitalOcean servers without worrying about the underlying infrastructure.
Follow the Quickstart instructions for creating a DigitalOcean Container Registry, and push your image to the registry.
Deploy Resource using a Container Image as the Source
Visit the Apps page.
Click Create App if starting from scratch, or click an existing app to add your container image to it.
- If adding an image to an existing app, click the Create button and choose Create Resources From Source Code. You can add a Web Service, Worker, Job, or Functions.
Select DigitalOcean Container Registry as the source for your code, choose the image you would like to use from the Repository drop-down, and select the tag of the image you would like to deploy.
- By default your application will be re-deployed whenever you push a new image to this tag. Uncheck the Autodeploy option to disable this feature.
Configure resources for your app.
- On the Resources page, click Edit Plan to select a plan and instance size you would like to use when a container is created from the image.
- Click the edit icon corresponding to the resource to configure details such as HTTP routes, the run command, or the HTTP port. App Platform displays build and run commands that it detected, which you can customize as needed. Refer to the cloud-native buildpacks for instructions for specific buildpacks. For Dockerfile-based builds, entering a run command overrides the Dockerfile’s entrypoint.
- Add new resources by expanding the Add Resource (Optional) section and selecting the Detect from Source Code option. Then, click Add. If your app needs a database, select the Database option to add a dev database or an existing managed database from your DigitalOcean account. The connection details for your database will be accessible via environment variables so that they can be conveniently accessed in your code.
If you want to use resource- and app-level environment variables, on the Environment page, click Edit to supply them. Click the Encrypt checkbox to ensure a variable’s value is encrypted in the App Spec. Click Next.
If you want to change the default name or project for your app, or choose the region where you would like your app to be hosted, click Edit on the Info page. Click Save and then click Next.
- The option to select a region is not available for static sites. Static components are served on DigitalOcean’s global CDN.
Review your app’s resources, environment variables and billing information on the Review page and then click Create Resources.
Once your app deploys, you can view the app at the URL at the top of the app’s Overview page.
Change the Tag of the Container Source After Deployment
You can change the tag and autodeploy settings of the container image to use as the source of an existing deployment:
- Visit the Apps page, click your app, and navigate to the Settings tab.
- Click the icon for the resource that you created using a container from your registry.
- Under the Source heading, click the Edit link. Use the Tag drop-down to select the desired tag. Use the Autodeploy checkbox to set your autodeploy preferences. Press Save to save the new settings and re-deploy your app.