Skip to content

Commit d3f4d2a

Browse files
committed
Init
0 parents  commit d3f4d2a

11 files changed

+808
-0
lines changed

.dockerignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.git
2+
.next
3+
.sst
4+
node_modules

.gitignore

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.*
7+
.yarn/*
8+
!.yarn/patches
9+
!.yarn/plugins
10+
!.yarn/releases
11+
!.yarn/versions
12+
13+
# testing
14+
/coverage
15+
16+
# next.js
17+
/.next/
18+
/out/
19+
20+
# production
21+
/build
22+
23+
# misc
24+
.DS_Store
25+
*.pem
26+
27+
# debug
28+
npm-debug.log*
29+
yarn-debug.log*
30+
yarn-error.log*
31+
32+
# local env files
33+
.env*.local
34+
35+
# vercel
36+
.vercel
37+
38+
# typescript
39+
*.tsbuildinfo
40+
next-env.d.ts
41+
42+
# sst
43+
.sst
44+
sst-env.d.ts

Dockerfile

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
FROM node:18-alpine AS base
2+
3+
# Stage 1: Install dependencies
4+
FROM base AS deps
5+
WORKDIR /app
6+
COPY package.json pnpm-lock.yaml ./
7+
COPY sst-env.d.ts* ./
8+
RUN corepack enable pnpm && pnpm install --frozen-lockfile
9+
10+
# Stage 2: Build the application
11+
FROM base AS builder
12+
WORKDIR /app
13+
COPY --from=deps /app/node_modules ./node_modules
14+
COPY . .
15+
RUN corepack enable pnpm && pnpm run build
16+
17+
# Stage 3: Production server
18+
FROM base AS runner
19+
WORKDIR /app
20+
ENV NODE_ENV=production
21+
COPY --from=builder /app/.next/standalone ./
22+
COPY --from=builder /app/.next/static ./.next/static
23+
24+
EXPOSE 3000
25+
CMD ["node", "server.js"]

README.md

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Deploy Next.js with SST
2+
3+
This is a Next.js template which can be deployed with [SST](https://sst.dev) as a container.
4+
5+
## Deploying to SST
6+
7+
This will deploy your Next.js app to AWS Fargate with Amazon ECS.
8+
9+
1. Create an AWS account
10+
1. Configure your [AWS credentials](https://sst.dev/docs/iam-credentials#credentials)
11+
1. Install the SST CLI: `pnpm i -g sst`
12+
1. Install SST providers: `sst install`
13+
1. Install [Docker](https://docs.docker.com/get-docker/) on your machine
14+
1. Build your container: `docker build -t nextjs-docker .`
15+
1. Deploy: `sst deploy --stage production`
16+
17+
For more information, see the Next.js [deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying#self-hosting).
18+
19+
## Learn More
20+
21+
To learn more about Next.js, take a look at the following resources:
22+
23+
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
24+
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
25+
26+
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome!

app/layout.tsx

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import type { Metadata } from 'next';
2+
3+
export const metadata: Metadata = {
4+
title: 'Next.js with SST',
5+
description: 'Deploy your Next.js application with SST.',
6+
};
7+
8+
export default function RootLayout({
9+
children,
10+
}: Readonly<{
11+
children: React.ReactNode;
12+
}>) {
13+
return (
14+
<html lang="en">
15+
<body>{children}</body>
16+
</html>
17+
);
18+
}

app/page.tsx

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export default function Home() {
2+
return (
3+
<main>
4+
<div>Next.js with SST</div>
5+
</main>
6+
);
7+
}

next.config.ts

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import type { NextConfig } from 'next';
2+
3+
const nextConfig: NextConfig = {
4+
output: 'standalone',
5+
};
6+
7+
export default nextConfig;

package.json

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"private": true,
3+
"scripts": {
4+
"dev": "next dev --turbo",
5+
"build": "next build",
6+
"start": "node .next/standalone/server.js"
7+
},
8+
"dependencies": {
9+
"next": "15.0.0-canary.196",
10+
"react": "19.0.0-rc-cd22717c-20241013",
11+
"react-dom": "19.0.0-rc-cd22717c-20241013"
12+
},
13+
"devDependencies": {
14+
"@types/node": "^20",
15+
"@types/react": "^18",
16+
"@types/react-dom": "^18",
17+
"typescript": "^5"
18+
}
19+
}

0 commit comments

Comments
 (0)