I have added RUN apt-get update in my Dockerfile, and on deployment, it’s throwing this error: Error: failed to fetch an image or build from source: error building: failed to solve: process "/bin/sh -c apt-get clean && apt-get update did not complete successfully: exit code: 127
Has anyone experienced this problem?
Here is how I deploy the code in Git CI/CD: flyctl deploy --config ./fly.us.toml --wait-timeout 1200 --local-only ${buildArgs}
I’m guessing that you have a Dockerfile that was formed by gathering up pieces from various sources. apt is for use with Debian based operating systems; apk is what you would use with alpine.
Our dockerfile generator defaults to the base node images, and therefore Debian, but provides --alpine as an option.
hi @rubys Thanks, but I’m not sure I understand what you mean specifically. I have a custom Dockerfile where I install the necessary libraries.
Here is my docker file:
# Use an official Node.js runtime as a parent image
FROM node:16-alpine
# Set the working directory
WORKDIR .
# Install Python, make, and g++ for building native dependencies
RUN apk --no-cache add python3 make g++
# Copy package.json and package-lock.json (or yarn.lock)
COPY package.json package-lock.json ./
# Install dependencies and rebuild bcrypt
RUN npm install --legacy-peer-deps && npm rebuild bcrypt --build-from-source
# Install Puppeteer globally
RUN npm install -g puppeteer
# Install Chromium and its dependencies
# Update the package list
RUN apt-get update
# Install Chromium
#RUN apt-get install -y chromium
# Copy the rest of your app's source code
COPY . .
# Arguments passed via --build-arg are converted to environment variables
ARG PORT
ARG X_API_KEY
# Set them as environment variables
ENV PORT=${PORT}
ENV X_API_KEY=${X_API_KEY}
# Build your app
RUN npm run build
# Expose the port the app runs on
EXPOSE 5001
# Command to run your app
CMD ["npm", "run", "start:prod"]