mjavacam
mjavacam
RRailway
Created by mjavacam on 9/30/2023 in #✋|help
Vite + Docker Deployment is Successful But Application Fail To Respond Error - Help with Deployment
Project ID: 2942e240-e493-4fc3-8ec1-d06a31b5444c I have attempted to deploy a vite app using nginx via docker but for some reason everytime it deploys it keeps saying "Application failed to respond" error. I have tried a few of the issues that are related to the similar but no solution worked so far. I think I may be doing something wrong on my end. I have replicated the steps locally and the image builds. When tested the app responds in the container but once deployed, I believe nginx seems to stall on railway. The app is using react-router-dom not sure if this would be an issue but stating it for additional content Any insight in what I may be doing wrong could help:
FROM node:18 AS base
WORKDIR /app
COPY package.json .
RUN yarn install

FROM base AS build
WORKDIR /app
ARG VITE_API_BASE_URL
ARG VITE_DIRECTLINE_TOKEN_URI
ENV VITE_API_BASE_URL=${VITE_API_BASE_URL}
ENV VITE_DIRECTLINE_TOKEN_URI=${VITE_DIRECTLINE_TOKEN_URI}
COPY --from=base /app/node_modules ./node_modules
COPY --from=base /app/package.json /app/yarn.lock ./
COPY . .
RUN yarn build

FROM nginx:alpine AS production
WORKDIR /usr/share/nginx/html
# RUN rm -rf ./*
# COPY .nginx/nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=build /app/dist .
# EXPOSE 80
# ENTRYPOINT ["nginx", "-g", "daemon off;"]
FROM node:18 AS base
WORKDIR /app
COPY package.json .
RUN yarn install

FROM base AS build
WORKDIR /app
ARG VITE_API_BASE_URL
ARG VITE_DIRECTLINE_TOKEN_URI
ENV VITE_API_BASE_URL=${VITE_API_BASE_URL}
ENV VITE_DIRECTLINE_TOKEN_URI=${VITE_DIRECTLINE_TOKEN_URI}
COPY --from=base /app/node_modules ./node_modules
COPY --from=base /app/package.json /app/yarn.lock ./
COPY . .
RUN yarn build

FROM nginx:alpine AS production
WORKDIR /usr/share/nginx/html
# RUN rm -rf ./*
# COPY .nginx/nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=build /app/dist .
# EXPOSE 80
# ENTRYPOINT ["nginx", "-g", "daemon off;"]
67 replies