Skip to content

Commit

Permalink
Merge pull request #168 from DefangLabs/one-click
Browse files Browse the repository at this point in the history
One click
  • Loading branch information
raphaeltm authored Aug 30, 2024
0 parents commit 64395b3
Show file tree
Hide file tree
Showing 19 changed files with 5,196 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Deploy

on:
push:
branches:
- main

jobs:
deploy:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write

steps:
- name: Checkout Repo
uses: actions/checkout@v4

- name: Deploy
uses: DefangLabs/[email protected]
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Next.js

[![1-click-deploy](https://defang.io/deploy-with-defang.png)](https://portal.defang.dev/redirect?url=https%3A%2F%2Fgithub.com%2Fnew%3Ftemplate_name%3Dsample-nextjs-template%26template_owner%3DDefangSamples)

A basic Next.js app with a Dockerfile and compose.yaml ready to deploy to AWS with [Defang](https://defang.io).

## Steps

1. [Install Defang](https://docs.defang.io/docs/getting-started/installing)
2. [Authenticate with Defang](https://docs.defang.io/docs/getting-started/authenticating)
3. (optional) [Authenticate with AWS](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html)
4. Run `defang compose up` in the root of this project

---

Title: Next.js

Short Description: A basic Next.js app.

Tags: Next.js, React, Docker, AWS, Node.js, TypeScript, JavaScript

Languages: nodejs
16 changes: 16 additions & 0 deletions compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
services:
web:
restart: unless-stopped
# domainname: mydomain.com # if you want to use your own domain
build:
context: ./web
dockerfile: Dockerfile
ports:
- target: 3000
mode: ingress
published: 3000
deploy:
resources:
reservations:
cpus: '0.50'
memory: 512M
2 changes: 2 additions & 0 deletions web/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
.next
3 changes: 3 additions & 0 deletions web/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "next/core-web-vitals"
}
36 changes: 36 additions & 0 deletions web/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js
.yarn/install-state.gz

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env*.local

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts
23 changes: 23 additions & 0 deletions web/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Start from the official Node.js LTS image
FROM node:20-alpine

# Set the working directory
WORKDIR /app

# Copy package.json and package-lock.json
COPY package*.json ./

# Install dependencies
RUN npm install

# Copy the rest of your app's source code
COPY . .

# Build the Next.js app
RUN npm run build

# Expose the port that your app runs on
EXPOSE 3000

# Start the app
CMD ["npm", "start"]
4 changes: 4 additions & 0 deletions web/next.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/** @type {import('next').NextConfig} */
const nextConfig = {};

export default nextConfig;
Loading

0 comments on commit 64395b3

Please sign in to comment.