./Dockerfiledoes not exist error when deploying a django project
6 months ago
why is it that every time i try to deploy my django project using the Docker image im getting the error "Dockerfile ./Dockerfile
does not exist" yet it is in the same directory with the railway.toml file.
Ive triple checked the contents of both files and they seem to be okay.
I dont know if the problem is still on my end.
Please let me know if i have to provide extra context like the code in my files in order to be helped or in the very least guide me on how to properly deploy a django-tailwind project on railway with or without using docker
7 Replies
6 months ago
Hello,
Please try removing the dockerfilePath
setting from your railway.toml file, the ./
is likely incorrect.
We will use the Dockerfile
from the root automatically, so this setting is not needed here anyway.
Best,
Brody
Status changed to Awaiting User Response Railway • 6 months ago
6 months ago
I also tried that option and still got the same error
Can you just give be like an overview of how to deploy a basic django tailwind project on here or maybe guide me to a resource i can use
Status changed to Awaiting Railway Response Railway • 6 months ago
Status changed to Awaiting User Response Railway • 6 months ago
6 months ago
i did all that before contacting support i also tried deleting everything and redeploying again but all in vain
Status changed to Awaiting Railway Response Railway • 6 months ago
6 months ago
I unfortunately cannot view deleted logs, if you would like further help getting the Dockerfile to be detected, please first try what I have suggested.
Status changed to Awaiting User Response Railway • 6 months ago
6 months ago
can you see it now i redeployed like 27 minutes ago
This is my railway.toml:
[build]
builder = "DOCKERFILE"
dockerfilePath = "Dockerfile"
watchPatterns = [
"requirements.txt",
"src/**",
"railway.toml",
"Dockerfile",
]
this is my Dockerfile:
# Set the python version as a build-time argument
# with Python 3.12 as the default
ARG PYTHON_VERSION=3.12-slim-bullseye
FROM python:${PYTHON_VERSION}
# Create a virtual environment
RUN python -m venv /opt/venv
# Set the virtual environment as the current location
ENV PATH=/opt/venv/bin:$PATH
# Upgrade pip
RUN pip install --upgrade pip
# Set Python-related environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
# Install os dependencies for our mini vm
RUN apt-get update && apt-get install -y \
# for postgres
libpq-dev \
# for Pillow
libjpeg-dev \
# for CairoSVG
libcairo2 \
# other
gcc \
&& rm -rf /var/lib/apt/lists/*
# Create the mini vm's code directory
RUN mkdir -p /code
# Set the working directory to that same code directory
WORKDIR /code
# Copy the requirements file into the container
COPY requirements.txt /tmp/requirements.txt
# copy the project code into the container's working directory
COPY ./src /code
# Install the Python project requirements
RUN pip install -r /tmp/requirements.txt
# database isn't available during build
# run any other commands that do not need the database
# such as:
# RUN python manage.py collectstatic --noinput
# set the Django default project name
ARG PROJ_NAME="core"
# create a bash script to run the Django project
# this script will execute at runtime when
# the container starts and the database is available
RUN printf "#!/bin/bash\n" > ./paracord_runner.sh && \
printf "RUN_PORT=\"\${PORT:-8000}\"\n\n" >> ./paracord_runner.sh && \
printf "python manage.py migrate --no-input\n" >> ./paracord_runner.sh && \
printf "gunicorn ${PROJ_NAME}.wsgi:application --bind \"[::]:\$RUN_PORT\"\n" >> ./paracord_runner.sh
# make the bash script executable
RUN chmod +x paracord_runner.sh
# Clean up apt cache to reduce image size
RUN apt-get remove --purge -y \
&& apt-get autoremove -y \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Run the Django project via the runtime script
# when the container starts
CMD ./paracord_runner.sh
Status changed to Awaiting Railway Response Railway • 6 months ago
6 months ago
I'm sorry but I don't have the ability to debug deleted projects.
Going to close this out, if you need further help, please open a new thread.
Status changed to Awaiting User Response Railway • 6 months ago
Status changed to Closed brody • 6 months ago