You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you are using Railway-Provided Domain (haven't yet tested it on custom domains) then the mapping is 443:$PORT
For example, if you Railway-Provided Domain is "foo.up.railway.app" and you successfully deployed a github repository with a Dockerfile then all requests to "https://foo.up.railway.app:443" will be transferred to container port defined by $PORT.
You can define $PORT in Varables and use it in Dockerfile to configure your dotnet core app like this:
Lets say:
PORT environment variable is 7001
Railway-Provided Domain is "foo.up.railway.app"
and Dockerfile looks like this:
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build-env
WORKDIR /app
COPY . ./
RUN dotnet restore
RUN dotnet publish -c Release -o out
FROM mcr.microsoft.com/dotnet/aspnet:6.0
WORKDIR /app
COPY --from=build-env /app/out .
ARG PORT
ENV PORT $PORT
ENV ASPNETCORE_URLS=http://+:$PORT
EXPOSE $PORT/tcp
RUN echo "ASPNETCORE_URLS: [$ASPNETCORE_URLS]"
RUN echo "PORT: [$PORT]"
ENTRYPOINT ["dotnet", "my-project.dll"]
When the project with this Dockerfile is deployed you should see Deploy Logs like this:
info: Microsoft.Hosting.Lifetime[14]
Now listening on: http://[::]:7001
info: Microsoft.Hosting.Lifetime[0]
Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
Hosting environment: Production
info: Microsoft.Hosting.Lifetime[0]
Content root path: /app/
Hi, i'm trying deploy using Dockerfile. I dont know how to mapping port . Please help
The text was updated successfully, but these errors were encountered: