You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## Github Actions with prebuilt Container Images (Optional)
241
+
242
+
Deploying an application to DigitalOcean can be done using prebuilt container images stored in a container registry such as [Digital Ocean Container Registry](https://www.digitalocean.com/products/container-registry). Using prebuilt images helps speed up deployment, eliminate the need to install dependencies on the server, and ensure build reproducibility.
243
+
244
+
To use prebuilt container images, navigate to the DigitalOcean Container Registry tab and click the Create a Container Registry button.
245
+
246
+
1. Select the Basic plan, choose the region that matches your app’s region, specify a name for the container registry, and click Create Registry.
247
+
248
+
2. Add two new GitHub Actions workflows to build and push updated images so they can be attached to your DigitalOcean Apps. Don’t forget to replace `registry.digitalocean.com/ship-demo/ship-demo-${{ matrix.app_name }}:${{ github.sha }}` with your own values from DigitalOcean.
249
+
250
+
**API Build and Push Docker Image GH Action:**
251
+
```yaml
252
+
name: Build and Push Staging API Image to DigitalOcean
3. Add three new github secrets: `DO_USERNAME` (the email of your DigitalOcean account), `DO_WEB_STAGING_APP_NAME` (the name of the web app), and `DO_API_STAGING_APP_NAME` (the name of the API app). And run 2 new workflows manually to push the initial images to the DigitalOcean Container Registry.
361
+
362
+
4. Navigate to your DigitalOcean Container Registry. You should see 4 newly added repositories, as shown in the screenshot below.
363
+
364
+
5. Navigate to Application Spec `(settings tab)`. Remove `dockerfile_path`, `github`, `source_dir` variables for migrator, scheduler and api. Migrator is placed in the `jobs` section. You can also find it by name of the resource. The scheduler is placed in the `workers` section. The api is placed in the `services` section.
365
+
366
+
6. Add `image` variable for api, migrator and scheduler. You can check image `tag` in your DigitalOcean Container Registry.
367
+
368
+
**Image configuration :**
369
+
```yaml
370
+
image:
371
+
registry: YOUR_DO_REGISTRY_NAME
372
+
registry_type: DOCR
373
+
repository: YOUR_DO_REPOSITORY_NAME
374
+
tag: YOUR_RECENT_IMAGE_TAG
375
+
```
376
+
377
+
7. Do the same actions for web app.
378
+
379
+
8. Replace the old deployment action with the new one and remove the two actions: `Build and Push Staging API Image to DigitalOcean` and `Build and Push Staging Web Image to DigitalOcean`.
The name of the environment variable for the image tag must meet this requirement IMAGE_TAG_$component-name.
534
+
</Note>
535
+
240
536
## Set up migrator and scheduler (Optional)
241
537
242
538
Digital Ocean Apps allows configuring additional resources within one application, which can serve as background workers and jobs, and a scheduler to run before/after the deployment process.
0 commit comments