R
Railwayβ€’6mo ago
ZeroxAdvanced

Not correct python version in Nixpack when using dockerfile (used to work)

Hi there I am using a dockerFile with python:3.10-slim-buster
# Pull the official base image
FROM python:3.10-slim-buster

# Set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1

# The port environment variable is set by Railway when the container is run
# But we can default it to 8080 for local development
ENV PORT=8080

# Expose the port
EXPOSE $PORT

# Set work directory in the container
WORKDIR /code

# Install dependencies
# Copying the requirements file and installing dependencies separately
# from copying the entire project ensures that Docker's cache is used more effectively,
# and dependencies are not unnecessarily reinstalled upon every build.
COPY requirements.txt .
RUN pip install --no-cache-dir --upgrade pip \
&& pip install --no-cache-dir -r requirements.txt

# Copy project
COPY . /code/

# Command to run on container start ter
#CMD ["python", "main.py"]

# Command to run on container start
CMD uvicorn main:app --host 0.0.0.0 --port $PORT'
# Pull the official base image
FROM python:3.10-slim-buster

# Set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1

# The port environment variable is set by Railway when the container is run
# But we can default it to 8080 for local development
ENV PORT=8080

# Expose the port
EXPOSE $PORT

# Set work directory in the container
WORKDIR /code

# Install dependencies
# Copying the requirements file and installing dependencies separately
# from copying the entire project ensures that Docker's cache is used more effectively,
# and dependencies are not unnecessarily reinstalled upon every build.
COPY requirements.txt .
RUN pip install --no-cache-dir --upgrade pip \
&& pip install --no-cache-dir -r requirements.txt

# Copy project
COPY . /code/

# Command to run on container start ter
#CMD ["python", "main.py"]

# Command to run on container start
CMD uvicorn main:app --host 0.0.0.0 --port $PORT'
Problem: when i am deploying from my git it and I see the docker image being compiled i see using python setup β”‚ python38, gcc
I think i am not getting python version 3.10 as my dependancies seem broken but the python version is 3.8? This wasn't the case as i now cant install numpy. On my local machine the requirements.txt work perfectly and i can install all dependancies fine on WSL.
13.35 ERROR: Could not find a version that satisfies the requirement pandas==2.1.4 (from versions: 0.1,
13.35 ERROR: Could not find a version that satisfies the requirement pandas==2.1.4 (from versions: 0.1,
I used to compile the same image perfectly with the same docker file on railway in other project (haven't rebuild it since weeks though). What could be wrong? Any help would be appricated. project id =16173128-f966-4c24-9def-b463fcd1f62d
Solution:
when using a Dockerfile nixpacks is not applicable in any way, however why nixpacks is still being used is likely due to your misspelling of Dockerfile
Jump to solution
4 Replies
Percy
Percyβ€’6mo ago
Project ID: 16173128-f966-4c24-9def-b463fcd1f62d
Solution
Brody
Brodyβ€’6mo ago
when using a Dockerfile nixpacks is not applicable in any way, however why nixpacks is still being used is likely due to your misspelling of Dockerfile
ZeroxAdvanced
ZeroxAdvancedβ€’6mo ago
@Brody Hi there I think you are right! I had vscode open en had it named .Dockerfile should of course be "Dockerfile"...Deployed already 8 projects to Railway and never forgot this. Well now is the first time! Thanks for the solution!πŸ‘ Deployed again and working!
Brody
Brodyβ€’6mo ago
no problem!