Although I have set everything properly in my Dockerfile, refer to my Dockerfile:
# Use an official node runtime as a parent image
FROM node:14-alpine
# Set the working directory in the container
WORKDIR /app
# Copy package.json and package-lock.json
COPY package*.json ./
# Install any needed packages
RUN npm install
# Clean npm cache
RUN npm cache clean --force
# Copy the rest of the application code
COPY . .
# Copy the .env file
COPY .env .env
# Build the app for production and print logs if it fails
RUN npm run build || { echo "Build failed"; exit 1; }
# Install serve to serve the build
RUN npm install -g serve
# Make port 8080 available to the world outside this container
EXPOSE 8080
# Start the app
CMD ["serve", "-s", "build", "-l", "8080"]
and refer to my fly.toml as well:
app = "object-detection-frontend"
[env]
PORT = "8080"
[[services]]
internal_port = 8080
protocol = "tcp"
[[services.ports]]
handlers = ["http"]
port = 80
[[services.ports]]
handlers = ["tls", "http"]
port = 443
[[services.http_checks]]
interval = "10s"
grace_period = "5s"
method = "get"
path = "/"
protocol = "http"
restart_limit = 0
timeout = "2s"
I was to build my frontend image with the command: docker build -t frontend_react . --add-host my-hostname=0.0.0.0 and deploy the image with that command: flyctl deploy -a object-detection-frontend --local-only --image frontend_react.
When the image is finally pushed and deployed, even though the health checks were all fine, the app at https://object-detection-frontend.fly.dev does not get served correctly and it always says: ##Server is not found## with the message: “Hmm. We’re having trouble finding that site.” on firefox.
Any ideas about where the problem could be.