fly deploy node.js dockerfile broken: "Python" has no installation candidate

Hello!

After spinning up a new next.js app and running fly deploy, I received the following error:

#8 2.968 E: Package 'python' has no installation candidate
------
Error: failed to fetch an image or build from source: error building: executor failed running [/bin/sh -c apt-get update -qq &&     apt-get install -y python pkg-config build-essential]: exit code: 100

This must be related to the Dockerfile for Node.js that is automatically generated:

# syntax = docker/dockerfile:1

# Adjust NODE_VERSION as desired
ARG NODE_VERSION=18
FROM node:${NODE_VERSION}-slim as base

LABEL fly_launch_runtime="Next.js"

# Next.js app lives here
WORKDIR /app

# Set production environment
ENV NODE_ENV=production


# Throw-away build stage to reduce size of final image
FROM base as build

# Install packages needed to build node modules
RUN apt-get update -qq && \
    apt-get install -y python pkg-config build-essential 

# Install node modules
COPY --link package.json yarn.lock ./
RUN yarn install --frozen-lockfile --production=false

# Copy application code
COPY --link . .

# Build application
RUN yarn run build

# Remove development dependencies
RUN yarn install --production=true


# Final stage for app image
FROM base

# Copy built application
COPY --from=build /app /app

# Start the server by default, this can be overwritten at runtime
EXPOSE 3000
CMD [ "yarn", "run", "start" ]

I don’t think we need to install python to install node.js:

# Install packages needed to build node modules
RUN apt-get update -qq && \
    apt-get install -y python pkg-config build-essential 

While we’re here, I would set the default node version from 16 to 20, since Node v20 is about to become “current” in a couple of months anyway: GitHub - nodejs/Release: Node.js Release Working Group

This may be a flyctl bug. It should be python3.

% sudo apt-get install python
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package python is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
  2to3 python2-minimal:i386 python2:i386 python2-minimal python2 dh-python
  python-is-python3

E: Package 'python' has no installation candidate

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.