Improve react example
Signed-off-by: Solomon Hykes <sh.github.6811@hykes.org>
This commit is contained in:
@@ -3,31 +3,46 @@
|
||||
All example commands should be executed in the `examples/` directory
|
||||
in an up-to-date checkout of the [dagger repository](https://github.com/dagger/dagger).
|
||||
|
||||
## react-netlify: Deploy a React Web app to Netlify
|
||||
## react: Deploy a simple React application
|
||||
|
||||
This example shows how to deploy an example React Application to Netlify,
|
||||
using Dagger.
|
||||
This example shows how to deploy an example React Application.
|
||||
|
||||
1. Create a new deployment with the react-netlify deployment plan.
|
||||
Components:
|
||||
|
||||
- [Netlify](https://netlify.com) for application hosting
|
||||
- [Yarn](https://yarnpkg.com) for building
|
||||
- [Github](https://github.com) for source code hosting
|
||||
- [React-Todo-App](https://github.com/kabirbaidhya/react-todo-app) by Kabir Baidhya as a sample application.
|
||||
|
||||
1. Change the current directory to the example deployment plan
|
||||
|
||||
```sh
|
||||
dagger new --name example-one --base-dir ./react-netlify
|
||||
cd ./react
|
||||
```
|
||||
|
||||
2. Configure the deployment with your Netlify access token.
|
||||
2. Create a new deployment from the plan
|
||||
|
||||
```sh
|
||||
dagger new
|
||||
```
|
||||
|
||||
3. Configure the deployment with your Netlify access token.
|
||||
You can create new tokens from the [Netlify dashboard](https://app.netlify.com/user/applications/personal).
|
||||
|
||||
|
||||
```sh
|
||||
dagger -d example-one input secret todoApp.account.token MY_TOKEN
|
||||
dagger input text www.account.token MY_TOKEN
|
||||
```
|
||||
|
||||
3. You can deploy updates at any time
|
||||
*NOTE: there is a dedicated command for encrypted secret inputs, but it is
|
||||
not yet implemented. Coming soon!*
|
||||
|
||||
4. Deploy!
|
||||
|
||||
```sh
|
||||
dagger -d example-one up
|
||||
dagger up
|
||||
```
|
||||
|
||||
|
||||
## aws-eks: Kubernetes on AWS (EKS)
|
||||
|
||||
This example provisions a Kubernetes (EKS) cluster on AWS using Cloudformation,
|
||||
|
@@ -1,34 +0,0 @@
|
||||
todoApp:
|
||||
account:
|
||||
name: ENC[AES256_GCM,data:/T5E/8rU3YVxpA==,iv:dscf+kcVg0jYd5ICyJJL/f80BHyUDtfHWW9cRSP7aCU=,tag:xHZpdqNoYa58NbAX691vhg==,type:str]
|
||||
token: ENC[AES256_GCM,data:6RBg3KafhrJYS8hbACxNRtnkpSNeablIiqHhUZTjz04X3cPyP4igPn7cnw==,iv:kj0vn83GaAtocUBdacO5D+6SJu6sVxfs58LYvUdpivA=,tag:CzZFkr9sXFHOOQihqYBdTA==,type:str]
|
||||
sops:
|
||||
kms: []
|
||||
gcp_kms: []
|
||||
azure_kv: []
|
||||
hc_vault: []
|
||||
lastmodified: '2021-03-19T00:41:47Z'
|
||||
mac: ENC[AES256_GCM,data:eaDHLQHEH8wtCiDhcl9wWIC+WwitEBRr4K/p7chOKJ8sBc3wlH+dT3HVX5hTYX5rwU0ai2wgfcOg6mw4mDksIJvU4JpZV/AIo16ETjZDhRSc5hU1hUAiOQCYuJPqyGa12HzxzA81mcFm8kJETnoTYiTo7ApG9ShmOCp6XPezjPk=,iv:5Pd9eGTrVnr0ITNj/TrgJz9UE2SjVqqmOxxZOw0Spus=,tag:VGxPwp7hXHtz9Zvk+6WsqA==,type:str]
|
||||
pgp:
|
||||
- created_at: '2021-03-18T22:02:51Z'
|
||||
enc: |
|
||||
-----BEGIN PGP MESSAGE-----
|
||||
|
||||
hQIMAzqVY590vudzAQ/5ARrCGVOpwmCdsKV4MHwwGvmQCOhfidOqftWUXV5j3s08
|
||||
LFbwZcnTaHDNobgebmgS9WVwiR2GA955Fopz89Tp6MDVNkgQKK6rbJjpBCBrNTR9
|
||||
ko0/VLklrtW00PEWih23NOCinoFXk/yVlDaxDiyTzIdaYr5yY8nBsde7Kx7v1VqP
|
||||
Hniu65318B8EGGpPTbB8vG+9nAiZganCJmrzSNUo41jpmhPhRhAPQBVAWoBbJ4i1
|
||||
2MOtd46KWGsV+Y6+vqTwnJ1BuCOW1QzxaTp2AHlgYnApidqK8RFTOKONmfF0jgkk
|
||||
bKi5JIK2nObytHopuUj9wU0XkMqbHYYD9XbBXqGeMFmftvyGUqOzPZSTLYObTQbS
|
||||
/wKWjCnwHfRRWq9+z56K27EBY9ksgGEUhDA+IdhZPKfXBrW4N9u4YZHfMCJk1mPQ
|
||||
oAQzWAResWvyzuI+q3OlTmax95COog8kv1Xe2Mf/XNGLvkyvp9de8jtPkK23/CON
|
||||
0+7tH/p0UDrJZFNRQn65P18S0rgc1u2GOE5allD4th8TGNx1zk8GWNgc+jBUasnc
|
||||
teVToBpDejC4JtF2NcDm2zyXdhjXF9msGJWcofgwJgPciBy/j4D+X6+3MUvyjvv+
|
||||
DU4DmIq2a3sTVBQ0xdsAsF2phkjCUeFQY4LdcSbEUsvDuiTpoNq5yhY6ESMiny/S
|
||||
XgHByC8CVHfz/3XosgBo6lOTCwwP8yCLe+vJwEt3EiOZiNVQ8WUogIlq5hU91oTQ
|
||||
B5LTVCm2rJNb5zQzOd7/aF0t0h46xaZHm2WS0jsEwEWZM86OUPk8sAmFHRcVQ+s=
|
||||
=qLN2
|
||||
-----END PGP MESSAGE-----
|
||||
fp: 6CB37404020B5F0A0B41B5BB225EBAB0B936AC65
|
||||
unencrypted_suffix: _unencrypted
|
||||
version: 3.6.1
|
@@ -1,29 +0,0 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"dagger.io/netlify"
|
||||
"dagger.io/yarn"
|
||||
"dagger.io/git"
|
||||
)
|
||||
|
||||
repository: git.#Repository & {
|
||||
remote: "https://github.com/kabirbaidhya/react-todo-app.git"
|
||||
ref: "624041b17bd62292143f99bce474a0e3c2d2dd61"
|
||||
}
|
||||
|
||||
todoApp: netlify.#Site & {
|
||||
account: {
|
||||
// Create an API token in your Netlify account settings
|
||||
// https://app.netlify.com/user/applications/personal
|
||||
//
|
||||
// Fill using --input-string todoApp.account.token=XXX
|
||||
token: string
|
||||
}
|
||||
|
||||
name: "dagger-example-react-netlify"
|
||||
|
||||
contents: yarn.#Script & {
|
||||
source: repository
|
||||
run: "build"
|
||||
}
|
||||
}
|
32
examples/react/main.cue
Normal file
32
examples/react/main.cue
Normal file
@@ -0,0 +1,32 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"dagger.io/netlify"
|
||||
"dagger.io/yarn"
|
||||
"dagger.io/git"
|
||||
)
|
||||
|
||||
// Source code of the sample application
|
||||
repo: git.#Repository & {
|
||||
remote: "https://github.com/kabirbaidhya/react-todo-app.git"
|
||||
ref: "624041b17bd62292143f99bce474a0e3c2d2dd61"
|
||||
}
|
||||
|
||||
// Host the application with Netlify
|
||||
www: netlify.#Site & {
|
||||
// Site name can be overridden
|
||||
name: string | *"dagger-example-react"
|
||||
|
||||
// Deploy the output of yarn build
|
||||
// (Netlify build feature is not used, to avoid extra cost).
|
||||
contents: build
|
||||
}
|
||||
|
||||
// Build the application with Yarn
|
||||
build: yarn.#Script & {
|
||||
// What to build
|
||||
source: repo
|
||||
|
||||
// How to build it (name of yarn script)
|
||||
run: "build"
|
||||
}
|
Reference in New Issue
Block a user