├── .github └── workflows │ ├── prod.yml │ └── staging.yml ├── .gitignore ├── LICENSE ├── README.md ├── next.config.js ├── package-lock.json ├── package.json ├── pages ├── api │ └── hello.js └── index.js ├── public ├── favicon.ico └── vercel.svg ├── serverless-prod.yml └── serverless-staging.yml /.github/workflows/prod.yml: -------------------------------------------------------------------------------- 1 | # 2 | # GitHub Action for Serverless NextJS production environment 3 | # 4 | name: Deploy prod-your-site-name 5 | on: 6 | push: 7 | tags: # Deploy tag (e.g. v1.0) to production 8 | - "v**" 9 | jobs: 10 | deploy-prod: 11 | runs-on: ubuntu-latest 12 | steps: 13 | - uses: actions/checkout@v2 14 | 15 | - name: Configure AWS Credentials 16 | uses: aws-actions/configure-aws-credentials@v1 17 | with: 18 | aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} 19 | aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} 20 | aws-region: us-east-1 21 | 22 | - uses: canastro/copy-file-action@master 23 | with: 24 | source: "serverless-prod.yml" 25 | target: "serverless.yml" 26 | 27 | - uses: actions/setup-node@v2 28 | with: 29 | node-version: "14" 30 | cache: npm 31 | 32 | - name: Install dependencies 33 | run: npm ci 34 | 35 | - name: Serverless AWS authentication 36 | run: npx serverless --component=serverless-next config credentials --provider aws --key ${{ secrets.AWS_ACCESS_KEY_ID }} --secret ${{ secrets.AWS_SECRET_ACCESS_KEY }} 37 | 38 | # comment out this section on initial deploy 39 | - name: Download `.serverless` state from S3 40 | run: aws s3 sync s3://bhall2001-serverless-state-bucket/your-site-name/prod/.serverless .serverless --delete 41 | # end comment out this section on initial deploy 42 | 43 | - name: Deploy to AWS 44 | run: npx serverless 45 | 46 | - name: Upload `.serverless` state to S3 47 | run: aws s3 sync .serverless s3://bhall2001-serverless-state-bucket/your-site-name/prod/.serverless --delete 48 | -------------------------------------------------------------------------------- /.github/workflows/staging.yml: -------------------------------------------------------------------------------- 1 | # 2 | # GitHub Action for Serverless NextJS staging environment 3 | # 4 | name: Deploy staging-your-site-name 5 | on: 6 | push: 7 | branches: [main] 8 | jobs: 9 | deploy-staging: 10 | runs-on: ubuntu-latest 11 | steps: 12 | - uses: actions/checkout@v2 13 | 14 | - name: Configure AWS Credentials 15 | uses: aws-actions/configure-aws-credentials@v1 16 | with: 17 | aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} 18 | aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} 19 | aws-region: us-east-1 20 | 21 | - uses: canastro/copy-file-action@master 22 | with: 23 | source: "serverless-staging.yml" 24 | target: "serverless.yml" 25 | 26 | - uses: actions/setup-node@v2 27 | with: 28 | node-version: "14" 29 | cache: npm 30 | 31 | - name: Install dependencies 32 | run: npm ci 33 | 34 | # - name: Run tests 35 | # run: npm run test:ci 36 | 37 | - name: Serverless AWS authentication 38 | run: npx serverless --component=serverless-next config credentials --provider aws --key ${{ secrets.AWS_ACCESS_KEY_ID }} --secret ${{ secrets.AWS_SECRET_ACCESS_KEY }} 39 | 40 | # comment out this section on initial deploy 41 | - name: Download `.serverless` state from S3 42 | run: aws s3 sync s3://bhall2001-serverless-state-bucket/your-site-name/staging/.serverless .serverless --delete 43 | # end comment out this section on initial deploy 44 | 45 | - name: Deploy to AWS 46 | run: npx serverless 47 | 48 | - name: Upload `.serverless` state to S3 49 | run: aws s3 sync .serverless s3://bhall2001-serverless-state-bucket/your-site-name/staging/.serverless --delete 50 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # next.js 12 | /.next/ 13 | /out/ 14 | 15 | # production 16 | /build 17 | 18 | # misc 19 | .DS_Store 20 | 21 | # debug 22 | npm-debug.log* 23 | yarn-debug.log* 24 | yarn-error.log* 25 | 26 | # local env files 27 | .env.local 28 | .env.development.local 29 | .env.test.local 30 | .env.production.local 31 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Bob Hall 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # serverless-nextjs-github-ci-cd 2 | 3 | This is an opinionated view of how to setup a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) using [Serverless Nextjs Component](https://github.com/serverless-nextjs/serverless-next.js) with GitHub Actions for ci/cd. 4 | 5 | ## Motivation 6 | 7 | There is a desire to implement ci/cd process with the Serverless Nextjs Component with environments where checking into a branch in a GitHub repository performs ci/cd tasks resulting in a staging environment while tagging a commit with a version number (or creating a release in GitHub) performs ci/cd tasks for a production environment. 8 | 9 | Sites from ci/cd process: 10 | 11 | [Resulting staging environment](https://staging-your-site-name.bobhall.net) 12 | 13 | [Resulting production environment](https://prod-your-site-name.bobhall.net) 14 | 15 | ## Contents 16 | 17 | - [serverless-nextjs-github-ci-cd](#serverless-nextjs-github-ci-cd) 18 | - [Motivation](#motivation) 19 | - [Contents](#contents) 20 | - [Overview](#overview) 21 | - [Getting started](#getting-started) 22 | - [Install serverless](#install-serverless) 23 | - [Create S3 serverless assets storage bucket](#create-s3-serverless-assets-storage-bucket) 24 | - [Setup GitHub secrets](#setup-github-secrets) 25 | - [High level environment setup steps](#high-level-environment-setup-steps) 26 | - [Create serverless-ENVIRONMENT.yml](#create-serverless-environmentyml) 27 | - [Create staging GitHub action](#create-staging-github-action) 28 | - [Initial push](#initial-push) 29 | - [Finalize staging setup and test](#finalize-staging-setup-and-test) 30 | - [Create production configuration](#create-production-configuration) 31 | - [Deploy to production](#deploy-to-production) 32 | - [Finalize Production CI/CD](#finalize-production-cicd) 33 | - [Removing Serverless-nextjs](#removing-serverless-nextjs) 34 | - [Inspired by](#inspired-by) 35 | 36 | ## Overview 37 | 38 | This is an example of how to setup ci/cd for a project using the awesome serverless nextjs component. GitHub Actions are used to create a basic ci/cd workflow where commits to main branch deploy a staging environment while creating a release by tagging a commit deploy the production environment. 39 | 40 | The implementation is not for the faint of heart. Bootstrapping your project's resources requires manual steps and "priming the pump". The setup is not ideal for sure. However, once you get past the initial deployment, you will find the ci/cd to just work. 41 | 42 | The steps below take you through the exact steps to deploy this repo to Lambda@Edge. Hopefully you can follow along. To cut to the chase simply clone this repo for as a starter and filling in evn variables as needed. 43 | 44 | It is presumed that you know how to use git, GitHub, GitHub Actions, aws, the aws cli and understand what the Serverless Nextjs Component is and how it works. This process also requires that you have a domain managed by aws (Route 53) that is the targeted deployment domain. 45 | 46 | If you're not scared away yet, please follow along as you are guided through setting up your serverless-nextjs project for automated ci/cd with Github Actions. 47 | 48 | Note: this is likely a temporary solution until serverless-nextjs supports serverless framework component v2. 49 | 50 | ## Getting started 51 | 52 | Our goal is to deploy a project generated with create-next-app and serverless nextjs to staging and production environments simply by checking into the main branch and tagging a commit with a version number. 53 | 54 | First, create a new repository on GitHub. After all we intend to deploy staging and production environments automatically from Github ;-) 55 | 56 | Be sure to clone the repository to your local development environment. 57 | 58 | Next, create a new nextjs application. 59 | 60 | ```bash 61 | npx create-next-app 62 | ✔ What is your project named? serverless-nextjs-github-ci-cd 63 | ✔ Pick a template › Default starter app 64 | ``` 65 | 66 | Once installation is complete navigate to the project's home directory. 67 | 68 | ```bash 69 | cd serverless-nextjs-github-ci-cd 70 | ``` 71 | 72 | npm is used throughout this guide so we need to do a little cleanup to remove yarn.lock and create a package-lock.json file 73 | 74 | ```bash 75 | rm yarn.lock && npm install --package-lock-only 76 | ``` 77 | 78 | _The ci process requires that the package-lock.json file is tracked. Please ensure you commit package-lock.json to your repository._ 79 | 80 | now, confirm the nextjs development server is working. 81 | 82 | ```bash 83 | npm run dev 84 | ``` 85 | 86 | Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. 87 | 88 | Congratulations, you now have a working local development environment. 89 | 90 | Commit changes. 91 | 92 | ## Install serverless 93 | 94 | Installing the serverless framework as a development dependency results in advantages later on with the ci process. 95 | 96 | ```bash 97 | npm install serverless@latest --save-dev 98 | ``` 99 | 100 | ## Create S3 serverless assets storage bucket 101 | 102 | An S3 bucket is needed to store deployment configurations for the serverless-nextjs component. A single bucket can be used for all serverless-nextjs project. S3 bucket names must be unique within all of AWS. **If you check out this repo YOU MUST CHANGE THE NAME OF THE s3 bucket. You will get an error if you do not.** 103 | 104 | Create an S3 bucket named `-serverless-state-bucket`. Select the settings you'd wish. In general the default options are good. Be sure that "Block all public access" is checked. 105 | 106 | ## Setup GitHub secrets 107 | 108 | GitHub actions require your AWS key and secret. These need to be added to your GitHub account as environment variables. 109 | 110 | Log in to your GitHub account and navigate to Settings. Select Secrets in the left sidebar. Click New Secret to add `AWS_ACCESS_KEY_ID`. Click New Secret to add `AWS_SECRET_ACCESS_KEY`. 111 | 112 | ## High level environment setup steps 113 | 114 | In our scenario there are 3 environments: 115 | 116 | - dev: local development 117 | - staging: non production preview of dev environment deployed to AWS 118 | - prod: the "live" site that users access on AWS 119 | 120 | Staging and prod environments require their own serverless config file. Setting up a new environment has a similar recipe to the steps below. 121 | 122 | - create a serverless-ENVIRONMENT.yml file with environment configuration 123 | - create a GitHub action for the environment 124 | - comment out download of serverless state from S3 in GitHub action (does not exist until after first deploy) 125 | - execute a GitHub Action which runs the serverless command 126 | - uncomment out download of serverless state from S3 in GitHub action (now the .serverless directory exists in the S3 bucket so future deployments can download the directory) 127 | 128 | ## Create serverless-ENVIRONMENT.yml 129 | 130 | Here is a sample "staging" serverless configuration file. 131 | 132 | ```yaml 133 | # serverless-staging.yml 134 | name: staging-your-site-name 135 | 136 | staging-your-site-name: 137 | component: '@sls-next/serverless-component@latest' 138 | inputs: 139 | bucketName: staging-your-site-name-s3 140 | description: "Lambda@Edge for staging-your-site-name" 141 | name: 142 | defaultLambda: staging-your-site-name-lambda 143 | apiLambda: staging-your-site-name-lambda 144 | domain: ['staging-your-site-name', 'bobhall.net'] 145 | publicDirectoryCache: false 146 | runtime: 147 | defaultLambda: 'nodejs12.x' 148 | apiLambda: 'nodejs12.x' 149 | ``` 150 | 151 | ## Create staging GitHub action 152 | 153 | ```yaml 154 | # .github/workflows/staging.yml 155 | # 156 | # GitHub Action for Serverless NextJS staging environment 157 | # 158 | name: Deploy staging-your-site-name 159 | on: 160 | push: 161 | branches: [main] 162 | jobs: 163 | deploy-staging: 164 | runs-on: ubuntu-latest 165 | steps: 166 | - uses: actions/checkout@v2 167 | 168 | - name: Configure AWS Credentials 169 | uses: aws-actions/configure-aws-credentials@v1 170 | with: 171 | aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} 172 | aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} 173 | aws-region: us-east-1 174 | 175 | - uses: canastro/copy-file-action@master 176 | with: 177 | source: 'serverless-staging.yml' 178 | target: 'serverless.yml' 179 | 180 | - uses: actions/setup-node@v2-beta 181 | with: 182 | node-version: '12' 183 | 184 | - name: Install dependencies 185 | run: npm ci 186 | 187 | # - name: Run tests 188 | # run: npm run test:ci 189 | 190 | - name: Serverless AWS authentication 191 | run: npx serverless --component=serverless-next config credentials --provider aws --key ${{ secrets.AWS_ACCESS_KEY_ID }} --secret ${{ secrets.AWS_SECRET_ACCESS_KEY }} 192 | 193 | # - name: Download `.serverless` state from S3 194 | # run: aws s3 sync s3://bhall2001-serverless-state-bucket/your-site-name/staging/.serverless .serverless --delete 195 | 196 | - name: Deploy to AWS 197 | run: npx serverless 198 | 199 | - name: Upload `.serverless` state to S3 200 | run: aws s3 sync .serverless s3://bhall2001-serverless-state-bucket/your-site-name/staging/.serverless --delete 201 | ``` 202 | 203 | ## Initial push 204 | 205 | The first push after setting up the GitHub Action our serverless state bucket does not have a .serverless directory (required when deploying your website). The .serverless directory is copied to the S3 bucket on the first run of our process. Be sure the serverless-staging.yml file has these lines commented out for the initial commit/push. 206 | 207 | Commit your changes and push to GitHub. The push triggers your workflow to come to life executing the ci/cd steps. 208 | 209 | _I've found that when using bucketName the initial deployment may fail with an error about the bucket not having transfer acceleration. If this happens, simply re-run the full GitHub action in the GitHub ui._ 210 | 211 | If all goes well, after about 15 minutes, your staging environment is available. The initial deploy takes some time to set up and for the new endpoint to become available. Now that everything is setup, deployments go much faster. 212 | 213 | ## Finalize staging setup and test 214 | 215 | Once the site is available at the endpoint, remove comments in `.github/workflows/staging.yml` to enable downloading the .serverless directory from the S3 bucket during next the ci/cd process. 216 | 217 | Commit the changes and push to Github. 218 | 219 | Congratulations! You now have a ci/cd process for staging when commits are made to the main branch. 220 | 221 | Going forward the .serverless directory is downloaded as a step in your ci/cd process. 222 | 223 | ## Create production configuration 224 | 225 | Sample production serverless configuration. An advantage of separate files is that we are able to have different configurations for environments. In the setup below, the publicDirectoryCache is set to true. 226 | 227 | ```yaml 228 | # serverless-prod.yml 229 | name: prod-your-site-name 230 | 231 | prod-your-site-name: 232 | component: '@sls-next/serverless-component@latest' 233 | inputs: 234 | bucketName: prod-your-site-name-s3 235 | description: "Lambda@Edge for prod-your-site-name" 236 | name: 237 | defaultLambda: prod-your-site-name-lambda 238 | apiLambda: prod-your-site-name-lambda 239 | domain: ['prod-your-site-name', 'bobhall.net'] 240 | publicDirectoryCache: true 241 | runtime: 242 | defaultLambda: 'nodejs12.x' 243 | apiLambda: 'nodejs12.x' 244 | ``` 245 | 246 | Sample production GitHub Action 247 | 248 | ```yaml 249 | # .github/workflows/prod.yml 250 | # 251 | # GitHub Action for Serverless NextJS production environment 252 | # 253 | name: Deploy prod-your-site-name 254 | on: 255 | push: 256 | tags: # Deploy tag (e.g. v1.0) to production 257 | - 'v**' 258 | jobs: 259 | deploy-prod: 260 | runs-on: ubuntu-latest 261 | steps: 262 | - uses: actions/checkout@v2 263 | 264 | - name: Configure AWS Credentials 265 | uses: aws-actions/configure-aws-credentials@v1 266 | with: 267 | aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} 268 | aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} 269 | aws-region: us-east-1 270 | 271 | - uses: canastro/copy-file-action@master 272 | with: 273 | source: 'serverless-prod.yml' 274 | target: 'serverless.yml' 275 | 276 | - uses: actions/setup-node@v2-beta 277 | with: 278 | node-version: '12' 279 | 280 | - name: Install dependencies 281 | run: npm ci 282 | 283 | - name: Serverless AWS authentication 284 | run: npx serverless --component=serverless-next config credentials --provider aws --key ${{ secrets.AWS_ACCESS_KEY_ID }} --secret ${{ secrets.AWS_SECRET_ACCESS_KEY }} 285 | 286 | # - name: Download `.serverless` state from S3 287 | # run: aws s3 sync s3://bhall2001-serverless-state-bucket/your-site-name/prod/.serverless .serverless --delete 288 | 289 | - name: Deploy to AWS 290 | run: npx serverless 291 | 292 | - name: Upload `.serverless` state to S3 293 | run: aws s3 sync .serverless s3://bhall2001-serverless-state-bucket/your-site-name/prod/.serverless --delete 294 | ``` 295 | 296 | ## Deploy to production 297 | 298 | First, we need to commit these changes and push to the main branch. This will trigger the staging deploy. Wait for this deployment to complete. 299 | 300 | Using GitHub web ui, locate the "Release" panel in the right sidebar in the "Code" tab of your repository. Click "Create a new release" in the sidebar. 301 | 302 | Release version numbers must follow the pattern of "vX.Y.Z" (without quotes, v is required). Tag Version as v1.0.0. Add a title and/or a description to the release. 303 | 304 | _The next step will deploy your project to your "production" environment. DO NOT DO THE NEXT STEP UNTIL YOU ARE READY TO DEPLOY TO PRODUCTION._ 305 | 306 | Click the "Publish release" button. 307 | 308 | Congratulations. You have just deployed your serverless nextjs website to the world! 309 | 310 | ## Finalize Production CI/CD 311 | 312 | We have one last step to do before we can call it a victory. Uncomment the code to enable downloading the production .serverless directory from the S3 bucket in `.github/workflows/prod.yml`. 313 | 314 | ```yaml 315 | - name: Download `.serverless` state from S3 316 | run: aws s3 sync s3://bhall2001-serverless-state-bucket/your-site-name/prod/.serverless .serverless --delete 317 | ``` 318 | 319 | Commit these changes to main. What for the staging ci/cd to complete. Then create release v1.0.1 to confirm the final workflow deploys successfully. To create a new release click the Release title in the sidebar then the "Draft New Release" button. 320 | 321 | ## Removing Serverless-nextjs 322 | 323 | Serverless remove does not work correctly with the serverless-nextjs component. This is not related to Github actions ci/cd but is an issue with the component itself. 324 | 325 | If you need to remove a nextjs application deployed with serverless-nextjs component, follow these steps: 326 | 327 | 1. `serverless remove` from command line. 328 | 329 | 1. log in to aws console 330 | 331 | 1. navigate to CloudFront and disable the Distribution for the deployed serverless-nextjs component (be sure to select the correct distribution if you have many). 332 | 333 | 1. wait about 5 minutes 334 | 335 | 1. delete the CloudFront distribution for the deployed serverless-nextjs component (again make sure because there's no going back if you delete an incorrect distribution) 336 | 337 | 1. wait about 15 minutes. During this time your CloudFront distribution is deleted from edge locations 338 | 339 | 1. Now you can delete the Lambda function(s) created by the serverless-nextjs component. NOTE: If you get an error that the lambda function can not be deleted, you need to wait longer. The time does vary to delete all the CloudFront distributions. I find 15 minutes is an average time. There may be 1 or 2 lambda's -- one for content, one for api. 340 | 341 | You have now removed the serverless-nextjs deployment from aws. 342 | 343 | ## Inspired by 344 | 345 | [Serverless Nextjs Component](https://github.com/serverless-nextjs/serverless-next.js#serverless-nextjs-component) 346 | 347 | [Serverless deploy with state management in S3 ](https://gist.github.com/hadynz/b4e190e0ce10e5811cb462920a9c678f) 348 | 349 | [Github Actions - Deploy Serverless Framework (AWS)](https://gist.github.com/maxkostinevich/9672966565aeb749d41e49673be4e7fa) 350 | 351 | [Copy File GitHub Action](https://github.com/marketplace/actions/copy-file) 352 | -------------------------------------------------------------------------------- /next.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | target: 'serverless', 3 | }; 4 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "serverless-nextjs-github-ci-cd", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "dev": "next dev", 7 | "build": "next build", 8 | "start": "next start" 9 | }, 10 | "dependencies": { 11 | "next": "^12.1.0", 12 | "react": "^17.0.0", 13 | "react-dom": "^17.0.0" 14 | }, 15 | "devDependencies": { 16 | "serverless": "^3.7.1" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /pages/api/hello.js: -------------------------------------------------------------------------------- 1 | // Next.js API route support: https://nextjs.org/docs/api-routes/introduction 2 | 3 | export default (req, res) => { 4 | res.statusCode = 200 5 | res.json({ name: 'John Doe' }) 6 | } 7 | -------------------------------------------------------------------------------- /pages/index.js: -------------------------------------------------------------------------------- 1 | import Head from 'next/head' 2 | 3 | export default function Home() { 4 | return ( 5 |
6 | 7 | Create Next App 8 | 9 | 10 | 11 |
12 |

13 | Welcome to Next.js! 14 |

15 | 16 |

17 | Get started by editing pages/index.js 18 |

19 | 20 |
21 | 22 |

Documentation →

23 |

Find in-depth information about Next.js features and API.

24 |
25 | 26 | 27 |

Learn →

28 |

Learn about Next.js in an interactive course with quizzes!

29 |
30 | 31 | 35 |

Examples →

36 |

Discover and deploy boilerplate example Next.js projects.

37 |
38 | 39 | 43 |

Deploy →

44 |

45 | Instantly deploy your Next.js site to a public URL with Vercel. 46 |

47 |
48 |
49 |
50 | 51 | 61 | 62 | 192 | 193 | 207 |
208 | ) 209 | } 210 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bhall2001/serverless-nextjs-github-ci-cd/99dad2e4042fd429e164b52512f2092150dd0f3b/public/favicon.ico -------------------------------------------------------------------------------- /public/vercel.svg: -------------------------------------------------------------------------------- 1 | 3 | 4 | -------------------------------------------------------------------------------- /serverless-prod.yml: -------------------------------------------------------------------------------- 1 | name: prod-your-site-name 2 | 3 | prod-your-site-name: 4 | component: '@sls-next/serverless-component@latest' 5 | inputs: 6 | bucketName: prod-your-site-name-s3 7 | description: "Lambda@Edge for prod-your-site-name" 8 | name: 9 | defaultLambda: prod-your-site-name-lambda 10 | apiLambda: prod-your-site-name-lambda 11 | domain: ["prod-your-site-name", "bobhall.net"] 12 | publicDirectoryCache: true 13 | runtime: 14 | defaultLambda: "nodejs14.x" 15 | apiLambda: "nodejs14.x" 16 | -------------------------------------------------------------------------------- /serverless-staging.yml: -------------------------------------------------------------------------------- 1 | name: staging-your-site-name 2 | 3 | staging-your-site-name: 4 | component: '@sls-next/serverless-component@latest' 5 | inputs: 6 | bucketName: staging-your-site-name-s3 7 | description: "Lambda@Edge for staging-your-site-name" 8 | name: 9 | defaultLambda: staging-your-site-name-lambda 10 | apiLambda: staging-your-site-name-lambda 11 | domain: ["staging-your-site-name", "bobhall.net"] 12 | publicDirectoryCache: false 13 | runtime: 14 | defaultLambda: "nodejs14.x" 15 | apiLambda: "nodejs14.x" 16 | --------------------------------------------------------------------------------