Question

Deploy Docker Image from Turbo Repo To DO Apps

I have a local server nodejs repository that I am pushing to Container Registry which in turn triggers a build on DO Apps.

My Dockerfile is not in the root though but under /apps/server/Dockerfile since I am using Turborepo. To point this out to DO, I added this file under the root of the repository: /.do/app.yaml

It contains this:

name: <NAME OF MY IMAGE>
services:
  - name: <NAME OF MY APP>
    type: docker
    repository: registry.digitalocean.com/<REGISTRY NAME>/<IMAGE NAME>:latest
    dockerfile_path: apps/server/Dockerfile

I can see that the deployment is kicked of when I push to the container repository but it fails immediately:

[server] [2023-05-31 18:34:10] starting container: starting sub-container [yarn workspace @my-server start:prod]: creating process: failed to load /usr/bin/yarn: exec format error

What is going on here? It seems like it is recognizing my Dockerfile under apps/server since it has the right start command: yarn workspace @my-server start:prod But why is it trying to load yarn from usr/bin/yarn?

Thanks for any help


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Bobby Iliev
Site Moderator
Site Moderator badge
June 1, 2023

Hi there,

If I understand this correctly, I think that you’ve combined two separate concepts which might be conflicting:

  • You might want to deploy a pre-build image directly from the DigitalOcean container registry:

https://docs.digitalocean.com/products/app-platform/how-to/deploy-from-container-images/

That way you don’t have to build anything as the image would already be pre-built and available on there.

services:
- http_port: 8080
  image:
    deploy_on_push:
      enabled: true
    registry_type: DOCR
    repository: test-image
    tag: latest
  instance_count: 1
  instance_size_slug: basic-xxs
  name: test-image
  • Or you might want to deploy using a Dockerfile, in which case, you need to provide a Git repository where your project will be cloned from and then the Dockerfile provided will be used to build the project:

https://docs.digitalocean.com/products/app-platform/reference/dockerfile/

name: sample-dockerfile
services:
- name: web
  git:
    repo_clone_url: https://github.com/digitalocean/sample-dockerfile.git
    branch: main
  dockerfile_path: Dockerfile

Let me know if I am missing anything!

Best,

Bobby

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel