docker problem
hello everyone... I have deployed a serverpod project (dart) through a docker. but although the container is built correctly, I can't access it from the domain provided by railway.
The container should expose port 8080 but I can't get it to work and I'm out of ideas... can someone help me??
I leave you a copy of the dockerfile
FROM dart:stable AS build
WORKDIR /app
COPY . .
RUN dart pub get
RUN dart compile exe bin/main.dart -o bin/main
FROM jenkins/jenkins:lts
USER root
RUN apt-get update && \
apt-get -y install apt-transport-https \
ca-certificates curl gnupg2 \
software-properties-common && \
curl -fsSL https://download.docker.com/linux/$(. /etc/os-release; echo "$ID")/gpg > /tmp/dkey; apt-key add /tmp/dkey && \
add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/$(. /etc/os-release; echo "$ID") \
$(lsb_release -cs) \
stable" && \
apt-get update && \
apt-get -y install docker-ce
USER jenkins
ENV runmode=staging
ENV serverid=default
ENV logging=normal
ENV role=monolith
COPY --from=build /runtime/etc /etc
COPY --from=build /runtime/lib /lib
COPY --from=build /runtime/lib64 /lib64
COPY --from=build /runtime/usr /usr
COPY --from=build /app/bin/main /app/bin/main
COPY --from=build /app/config/ config/
COPY --from=build /app/generated/ generated/
COPY --from=build /app/web/ web/
EXPOSE 8080
EXPOSE 8081
EXPOSE 8082
CMD app/bin/main --mode $runmode --server-id $serverid --logging $logging --role $role
Solution:Jump to solution
please have your app listen on host 0.0.0.0 and the environment variable PORT, this PORT variable is auto assigned to your service, and without your app listening on it, railway won't know how to forward traffic to your app, thus you get that error page
4 Replies
Please provide your project ID or reply with
N/A
. Thread will automatically be closed if no reply is received within 10 minutes. You can copy your project's id by pressing Ctrl/Cmd + K -> Copy Project ID.No project ID was provided. Closing thread.
P-Id: 4b0eca38-a7cc-4e4a-a3ea-d080cd78a1e0
Solution
please have your app listen on host 0.0.0.0 and the environment variable PORT, this PORT variable is auto assigned to your service, and without your app listening on it, railway won't know how to forward traffic to your app, thus you get that error page