Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
7 changes: 7 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
node_modules
.next
.git
.vercel
out
dist
coverage
32 changes: 32 additions & 0 deletions .github/workflows/deploy-railway.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Deploy to Railway

# Needs the RAILWAY_TOKEN repository secret (project token for fuel-web); the job
# skips itself while it is missing.
on:
push:
branches: [main]
workflow_dispatch:

concurrency:
group: railway-fuel-graphql-docs
cancel-in-progress: false

jobs:
deploy:
runs-on: ubuntu-latest
timeout-minutes: 20
env:
RAILWAY_TOKEN: ${{ secrets.RAILWAY_TOKEN }}
steps:
- name: Check secret
id: gate
run: |
if [ -z "$RAILWAY_TOKEN" ]; then echo "RAILWAY_TOKEN not set; skipping"; echo "run=false" >> "$GITHUB_OUTPUT"; else echo "run=true" >> "$GITHUB_OUTPUT"; fi
- uses: actions/checkout@v4
if: steps.gate.outputs.run == 'true'
- name: Install Railway CLI
if: steps.gate.outputs.run == 'true'
run: npm install -g @railway/cli@4
- name: railway up
if: steps.gate.outputs.run == 'true'
run: railway up --ci --service fuel-graphql-docs
Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed
25 changes: 25 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Builds the docs as a Next.js standalone server for Railway.
# docker build -t fuel-graphql-docs .

FROM node:18-bookworm-slim AS build
RUN apt-get update && apt-get install -y --no-install-recommends python3 make g++ \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci
COPY . .
ENV NEXT_OUTPUT=standalone NEXT_TELEMETRY_DISABLED=1 NODE_ENV=production
ARG NEXT_PUBLIC_ALGOLIA_APP_ID
ARG NEXT_PUBLIC_ALGOLIA_SEARCH_API_KEY
RUN npm run build

FROM node:18-bookworm-slim AS runtime
WORKDIR /app
ENV NODE_ENV=production NEXT_TELEMETRY_DISABLED=1 HOSTNAME=0.0.0.0
COPY --from=build /app/.next/standalone ./
COPY --from=build /app/.next/static ./.next/static
COPY --from=build /app/public ./public
EXPOSE 3000
# next's standalone server listens on $PORT (Railway injects it).
HEALTHCHECK --interval=30s --timeout=5s CMD node -e "fetch('http://127.0.0.1:'+(process.env.PORT||3000)+'/').then(r=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))"
CMD ["node", "server.js"]
1 change: 1 addition & 0 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const depsLinkOpts = {
* @type {import('next').NextConfig}
*/
const nextConfig = {
output: process.env.NEXT_OUTPUT === 'standalone' ? 'standalone' : undefined,
basePath: process.env.DOCS_BASE_URL || '',
experimental: {
esmExternals: false,
Expand Down
86 changes: 43 additions & 43 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions railway.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"$schema": "https://railway.com/railway.schema.json",
"build": {
"builder": "DOCKERFILE",
"dockerfilePath": "Dockerfile"
},
"deploy": {
"healthcheckPath": "/",
"restartPolicyType": "ON_FAILURE",
"numReplicas": 1
}
}
Loading