Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1 +1,12 @@
fly.toml
.git
.github
.next
node_modules
npm-debug.log*
bun-debug.log*
.env
.env.*
!.env.example
Dockerfile
README.md
tsconfig.tsbuildinfo
61 changes: 58 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,58 @@
FROM pierrezemb/gostatic
COPY . /srv/http/
CMD ["-port","8080","-https-promote", "-enable-logging"]
# syntax = docker/dockerfile:1

# Adjust BUN_VERSION as desired
ARG BUN_VERSION=1.3.14
FROM oven/bun:${BUN_VERSION}-slim AS base

LABEL fly_launch_runtime="Next.js"

# Next.js app lives here
WORKDIR /app

ENV NEXT_TELEMETRY_DISABLED="1"


# Throw-away build stage to reduce size of final image
FROM base AS build

# Install packages needed to build node modules
RUN apt-get update -qq && \
apt-get install --no-install-recommends -y build-essential ca-certificates node-gyp pkg-config python-is-python3 && \
rm -rf /var/lib/apt/lists/*

# Install node modules
COPY package.json bun.lock prisma.config.ts ./
COPY prisma ./prisma
RUN bun install --frozen-lockfile

# Copy application code
COPY . .

Comment thread
shabebe11 marked this conversation as resolved.
# Public admin configuration must be present at build time because Next.js
# inlines NEXT_PUBLIC_* values into the client bundle during next build.
ARG NEXT_PUBLIC_ADMIN_ADDRESS
ARG NEXT_PUBLIC_ADMIN_ADDRESSES
ENV NEXT_PUBLIC_ADMIN_ADDRESS="${NEXT_PUBLIC_ADMIN_ADDRESS}"
ENV NEXT_PUBLIC_ADMIN_ADDRESSES="${NEXT_PUBLIC_ADMIN_ADDRESSES}"

# Build application (runs prisma generate + prisma:sync + next build via package.json)
RUN bun run build

# Remove development dependencies
RUN bun install --frozen-lockfile --production


# Final stage for app image
FROM base

ENV NODE_ENV="production"

# Copy built application
COPY --from=build /app /app

ENV HOSTNAME="0.0.0.0"
ENV PORT="3000"

# Start the server by default, this can be overwritten at runtime
EXPOSE 3000
CMD ["bun", "run", "start"]
2 changes: 1 addition & 1 deletion fly.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ primary_region = 'syd'
[build]

[http_service]
internal_port = 8080
internal_port = 3000
force_https = true
auto_stop_machines = 'stop'
auto_start_machines = true
Expand Down
2 changes: 1 addition & 1 deletion next-env.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />
import "./.next/dev/types/routes.d.ts";
import "./.next/types/routes.d.ts";

// NOTE: This file should not be edited
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"type": "module",
"scripts": {
"dev": "next dev",
"build": "prisma generate && npm run prisma:sync && next build",
"build": "prisma generate && node scripts/prisma-sync.mjs && next build",
"prisma:sync": "node scripts/prisma-sync.mjs",
"postinstall": "prisma generate",
"lint": "eslint .",
Expand Down
Loading