Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial docker support #335

Closed
wants to merge 12 commits into from
Closed
7 changes: 7 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Dockerfile
.dockerignore
node_modules
npm-debug.log
README.md
.next
.git
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
public-hoist-pattern[]=*@nextui-org/*
3 changes: 2 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
node_modules
.next
bun.lockb
migrations
migrations
pnpm-lock.yaml
27 changes: 27 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
FROM node:20-alpine AS base
RUN npm i -g pnpm
RUN apk add --no-cache libc6-compat
ENV DATABASE_URL file:./dev.db
ENV SKIP_ENV_VALIDATION true

FROM base AS builder
WORKDIR /app
COPY package.json pnpm-lock.yaml* .npmrc ./
RUN pnpm i --frozen-lockfile --ignore-scripts
RUN pnpm i --force @libsql/linux-x64-musl --prefix /tmp/libsql_bundle
COPY . .
RUN pnpm run node:build

FROM base
WORKDIR /app
ENV NODE_ENV production
COPY --from=builder /app/.next/standalone .
COPY --from=builder /app/dev.db .
COPY --from=builder /app/public ./public
COPY --from=builder /app/.next/static ./.next/static
COPY --from=builder /app/.next/server ./.next/server
COPY --from=builder /tmp/libsql_bundle/node_modules/@libsql/linux-x64-musl /app/node_modules/@libsql/linux-x64-musl
EXPOSE 3000
ENV PORT 3000
ENV HOSTNAME "0.0.0.0"
CMD ["node", "server.js"]
8 changes: 8 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: "3.8"
services:
noodle:
image: "noodle"
ports:
- "3000:3000"
env_file:
- .env
1 change: 1 addition & 0 deletions next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const nextConfig = {
reactStrictMode: true,
swcMinify: true,
pageExtensions: ["mdx", "ts", "tsx"],
output: "standalone",
experimental: {
serverComponentsExternalPackages: ["libsql"],
optimizePackageImports: ["@nextui-org/react"],
Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@
"db:generate": "drizzle-kit generate:sqlite",
"db:push": "drizzle-kit push:sqlite",
"db:studio": "drizzle-kit studio",
"db:migrate": "bun ./scripts/run-migrations.ts"
"db:migrate": "bun ./scripts/run-migrations.ts",
"node:dev": "pnpm run node:db:migrate && next dev",
"node:build": "pnpm run node:db:migrate && next build",
"node:db:migrate": "tsx ./scripts/run-migrations.ts"
},
"dependencies": {
"@clerk/nextjs": "^4.27.1",
Expand Down
Loading
Loading