a month 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!
8 Replies
a month ago
Hey there! We've found the following might help you get unblocked faster:
If you find the answer from one of these, please let us know by solving the thread!
a month ago
Can you change the port in settings -> public network (click edit on your public domain) to match you Port?
a month ago
Status changed to Solved brody • 28 days ago
a month ago
Trolled so hard, my bad team. Thanks for the quick help
Status changed to Awaiting Railway Response Railway • 28 days ago
Status changed to Solved trevor-trinh • 28 days ago
a month ago

Status changed to Awaiting Railway Response Railway • 28 days ago
Status changed to Solved brody • 28 days ago


