DEV Community

loading...
Cover image for Adding Deploy to DO button (Also found some bug)

Adding Deploy to DO button (Also found some bug)

Chomtana
I am programmer, I have no life
・1 min read

Add .do/deploy.template.yaml

I copy template from tutorial and add build_command and output_dir field

spec:
  name: chomtana-portfolio
  static_sites:
  - git:
      branch: master
      repo_clone_url: https://github.com/Chomtana/personal-site
    name: chomtana-portfolio
    build_command: yarn export
    output_dir: __sapper__/export
Enter fullscreen mode Exit fullscreen mode

Add Deploy to DigitalOcean button

Add these code to Readme.md

[![Deploy to DO](https://www.deploytodo.com/do-btn-blue.svg)](https://cloud.digitalocean.com/apps/new?repo=https://github.com/Chomtana/personal-site/tree/master)
Enter fullscreen mode Exit fullscreen mode

What is the bug?

The bug is the output_dir command is not working as you can see in these screenshot it failed to build because output_dir is not set. But I have checked that it has been set.

Deploy failed

No Output dir

Hotfix

We temporary fix this by adding cp -r __sapper__/export public command to build command in order to copy static site output from __sapper__/export to public folder

Then deployment successful!

Alt Text

Discussion (0)