a month ago
I am unable to run my application successfully , to seed my database, or to get the authentication to work and demo my app. I have tried what i know, including using the railway CLI on my local device, to debug but i'm not able to understand what the problem is because the docker container runs locally, so does the seeding.
right now i'm getting the error
Jun 26 10:32:51
Jun 26 10:32:51
The executable bash
could not be found.
Attachments
9 Replies
a month ago
Hey there! Are you able to share any of your dockerfile here? Would like to see what its doing
a month ago
# Use Node 20 as the base image
FROM --platform=linux/amd64 node:20-alpine
# Set working directory
WORKDIR /app
# Install necessary build dependencies including OpenSSL
RUN apk add --no-cache \
python3 \
make \
g++ \
git \
openssh-client \
openssl \
openssl-dev
# Copy package files
COPY package*.json ./
# Copy prisma files first
COPY prisma ./prisma/
# Install dependencies (without postinstall script)
RUN npm install --ignore-scripts
# Generate Prisma client
RUN npx prisma generate
# Install global dependencies
RUN npm install -g typescript @types/node
# Copy the rest of the application
COPY . .
# Add this before RUN npm run build
ENV SKIP_REDIS_CONNECTION=true
ENV SKIP_ENV_VALIDATION=true
# Build the application
RUN npm run build
# Create start script
COPY <<-"EOF" /app/start.sh
#!/bin/sh
if [ -z "$DATABASE_URL" ]; then
echo "Error: DATABASE_URL environment variable is not set"
exit 1
fi
echo "đī¸ Checking database migrations..."
npx prisma migrate status
echo "đī¸ Applying database migrations..."
npx prisma migrate deploy || {
echo "â ī¸ Migration failed, checking if columns already exist..."
echo "âšī¸ This might be due to columns already existing in the database"
echo "âšī¸ Continuing with application startup..."
}
echo "â ī¸ Database seeding temporarily disabled - will be run manually"
echo "âšī¸ After deployment, run: curl -X POST https://ubhubumr-production.up.railway.app/api/fix-database"
echo "âšī¸ Then run: railway run npx prisma db seed"
echo "đ Starting the application..."
npm start
EOF
RUN chmod +x /app/start.sh
# Expose port
EXPOSE 3000
# Start the application using the startup script
CMD ["/app/start.sh"]
a month ago
Replace the setup install block with this:
# Install necessary build dependencies including OpenSSL and bash
RUN apk add --no-cache \
bash \
python3 \
make \
g++ \
git \
openssh-client \
openssl \
openssl-dev
error
Replace the setup install block with this:# Install necessary build dependencies including OpenSSL and bash RUN apk add --no-cache \ bash \ python3 \ make \ g++ \ git \ openssh-client \ openssl \ openssl-dev
a month ago
Yes this looks correct to me just add bash line to the file as @error says
Accept his answer if this fixes your issue
a month ago
Alternatively use an image that already has bashFROM --platform=linux/amd64 node:20
Non-alpine version probably has bash
a month ago
If you might want to keep it skinny
Try change the run command - this is the last line of your dockerfile to CMD ["sh", "/app/start.sh"]
Status changed to Solved chandrika âĸ about 1 month ago
a month ago
Works great! thanks folks!
Status changed to Awaiting Railway Response Railway âĸ about 1 month ago