Clear dockerfile cache

Hi, I was trying to integrate sleep command before running the source for the internal DNS Resolver to setup. But it seems like it's still using the cached CMD command instead of the newly replaced ENTRYPOINT. Any ways to clear the cache?
Solution:
"start": "sleep 3 && <regular start command here>"
Jump to solution
17 Replies
Percy
Percy13mo ago
Project ID: 3659376b-b6c0-4169-88c9-8fe089930585
Brody
Brody13mo ago
more often than not this isnt a cahing issue, are you sure you dont have the start command set elsewhere?
The Big E in Math -> Σ
Nowhere else other than after the sleep
FROM node:20.3-alpine

# Install Dependencies
COPY package.json ./
RUN npm install

# Build Source
COPY . .
RUN npm run build

# Start
#CMD ["npm", "start"]
ENTRYPOINT [ "./runner.sh" ]
FROM node:20.3-alpine

# Install Dependencies
COPY package.json ./
RUN npm install

# Build Source
COPY . .
RUN npm run build

# Start
#CMD ["npm", "start"]
ENTRYPOINT [ "./runner.sh" ]
# Waiting for Railway DNS Resolver
echo "Waiting for Railway DNS (10s)..."
# Sleep for 10 seconds (railway internal DNS load time)
sleep 10
# Run the command
npm start
# Waiting for Railway DNS Resolver
echo "Waiting for Railway DNS (10s)..."
# Sleep for 10 seconds (railway internal DNS load time)
sleep 10
# Run the command
npm start
Can also confirm it's not executing the runner.sh since the log did not echo the message.
Brody
Brody13mo ago
what is getting printed then?
The Big E in Math -> Σ
Just the npm start logs as if I were using the old dockerfile
Brody
Brody13mo ago
can you check to make sure you don't have a start command set in the service settings, a railway.json or a Procfile, or even an environment variable that sets the start command
The Big E in Math -> Σ
Just confirmed start cmd is empty. I don't have any railway/Procfile config or env that touches startup param.
Brody
Brody13mo ago
are you deploying from the correct branch?
The Big E in Math -> Σ
yup, all changes are merged into main before being pull by railway.
Brody
Brody13mo ago
FROM node:20.3-alpine

# Install Dependencies
COPY package.json ./
RUN npm install

# Build Source
COPY . ./
RUN npm run build

# Start
CMD sleep 3 && npm run start
FROM node:20.3-alpine

# Install Dependencies
COPY package.json ./
RUN npm install

# Build Source
COPY . ./
RUN npm run build

# Start
CMD sleep 3 && npm run start
try that and i see youre using alpine, so please read this https://docs.railway.app/reference/private-networking#workaround-for-alpine-based-images
The Big E in Math -> Σ
weird, just found out that it wasn't using dockerfile at all, instead it was using Nixpacks
Brody
Brody13mo ago
dockerfiles need a capital D also, thats a good segway, why not just use nixpacks?
The Big E in Math -> Σ
I would, but the internal network delay breaks the db connections.
Brody
Brody13mo ago
yes so you do the sleep 3 thing
Solution
Brody
Brody13mo ago
"start": "sleep 3 && <regular start command here>"
The Big E in Math -> Σ
Got it working, thanks again!
Brody
Brody13mo ago
no problem!
Want results from more Discord servers?
Add your server