10 months ago
I have a nextjs project and have a local dockerfile. I want the port to stay 3000 (instead of railway 8080) for local development and my docker compose. This is my current frontend docker.
# Stage 1: Builder
FROM oven/bun:1 AS builder
WORKDIR /app
# Copy package files
COPY package.json bun.lockb* ./
# Install dependencies
RUN bun install --frozen-lockfile
# Copy source
COPY . .
ARG NEXT_PUBLIC_API_URL
ARG NEXT_PUBLIC_WS_URL
# Set environment variables for Next.js build
ENV NEXT_PUBLIC_API_URL=$NEXT_PUBLIC_API_URL
ENV NEXT_PUBLIC_WS_URL=$NEXT_PUBLIC_WS_URL
ENV NEXT_TELEMETRY_DISABLED=1
RUN bun run build
# Stage 2: Runtime
FROM oven/bun:1-slim
WORKDIR /app
# Copy built application from builder
COPY --from=builder /app/.next/standalone ./
COPY --from=builder /app/.next/static ./.next/static
COPY --from=builder /app/public ./public
ENV HOSTNAME=0.0.0.0
ENV PORT=3000
EXPOSE 3000
CMD ["bun", "server.js"]I didn't have the ENV hostname and port and this is what I'd see in the build logs.
From seeing some comments on here I guess I'm supposed to set the port manually and now see:
However when I visit the public website I get "Application Failed to respond" and "connection refused" in the logs.
It's a simple website, just nextjs template + shadcn install. Running it directly on vercel works.
Appreciate the help!
Pinned Solution
10 months ago
Can you change the port in settings -> public network (click edit on your public domain) to match you Port?
8 Replies
10 months ago
Hey there! We've found the following might help you get unblocked faster:
- 🧵 Getting Application failed to respond
- 🧵 502 Bad Gateway after connecting Meilisearch Service
- 🧵 the application stopped working
If you find the answer from one of these, please let us know by solving the thread!
10 months ago
Can you change the port in settings -> public network (click edit on your public domain) to match you Port?
10 months ago
Status changed to Solved brody • 10 months ago
10 months ago
Trolled so hard, my bad team. Thanks for the quick help
Status changed to Awaiting Railway Response Railway • 10 months ago
Status changed to Solved trevor-trinh • 10 months ago
10 months ago
🙂
Status changed to Awaiting Railway Response Railway • 10 months ago
Status changed to Solved brody • 10 months ago

