==> Creating build context
--> Creating build context done
==> Building image with Docker
--> docker host: 20.10.12 linux x86_64
Sending build context to Docker daemon 14.97kB
[+] Building 6.2s (8/13)
=> [internal] load remote build context 0.0s
=> copy /context / 0.0s
=> resolve image config for docker.io/docker/dockerfile:1 0.4s
=> docker-image://docker.io/docker/dockerfile:1@sha256:39b85bbfa7536a5feceb7372a0 0.3s
=> => resolve docker.io/docker/dockerfile:1@sha256:39b85bbfa7536a5feceb7372a08176 0.0s
=> => extracting sha256:a47ff7046597eea0123ea02817165350e3680f75000dc5d69c9a31025 0.2s
=> => sha256:39b85bbfa7536a5feceb7372a0817649ecb2724562a38360f4d6 8.40kB / 8.40kB 0.0s
=> => sha256:966d40f9ba8366e74c2fa353fc0bc7bbc167d2a0f3ad2420db8b9e63 482B / 482B 0.0s
=> => sha256:dbdd11720762ad504260c66161c964e59eba06b95a7aa64a6863 2.90kB / 2.90kB 0.0s
=> => sha256:a47ff7046597eea0123ea02817165350e3680f75000dc5d69c 11.55MB / 11.55MB 0.1s
=> [internal] load metadata for docker.io/library/node:18.15.0-slim 0.1s
=> [base 1/3] FROM docker.io/library/node:18.15.0-slim@sha256:639e94182196dccc83a 3.2s
=> => resolve docker.io/library/node:18.15.0-slim@sha256:639e94182196dccc83a45224 0.0s
=> => sha256:095c1ce1491a2109e1c41b6ec3ba3726564f7ba93bcae64187fc 1.37kB / 1.37kB 0.0s
=> => sha256:9bea78a32dc7bfb874c53484dee9d885ab41fc80677c5e826b0e 6.84kB / 6.84kB 0.0s
=> => sha256:26c5c85e47da3022f1bdb9a112103646c5c29517d757e95426 31.42MB / 31.42MB 0.4s
=> => sha256:96da4c1974ec407e9c85ee9c418a567a28da4980460fa22ae124 4.18kB / 4.18kB 0.0s
=> => sha256:265a4d24e7df63a67c31cfa7fd56c9a89d006982d4e9a4e90d 46.06MB / 46.06MB 0.5s
=> => sha256:2ac293a3f2e8157f3a118eabfdb6e4ff84d38800ac91d8659c38 2.76MB / 2.76MB 0.1s
=> => sha256:6e7507789d867dd350c0703eae24110bffaacdc7d4f217e4cc759dd2 449B / 449B 0.0s
=> => sha256:639e94182196dccc83a45224a10d2a3cb4139c0e3d05194b64d6 1.21kB / 1.21kB 0.0s
=> => extracting sha256:26c5c85e47da3022f1bdb9a112103646c5c29517d757e95426f16e4bd 1.0s
=> => extracting sha256:96da4c1974ec407e9c85ee9c418a567a28da4980460fa22ae124fba80 0.0s
=> => extracting sha256:265a4d24e7df63a67c31cfa7fd56c9a89d006982d4e9a4e90df72967e 1.4s
=> => extracting sha256:2ac293a3f2e8157f3a118eabfdb6e4ff84d38800ac91d8659c383bc77 0.1s
=> => extracting sha256:6e7507789d867dd350c0703eae24110bffaacdc7d4f217e4cc759dd2e 0.0s
=> [base 2/3] WORKDIR /app 0.1s
=> ERROR [base 3/3] RUN npm install -g yarn@1.22.19 1.8s
------
> [base 3/3] RUN npm install -g yarn@1.22.19:
#8 1.825 npm ERR! code EEXIST
#8 1.826 npm ERR! path /usr/local/bin/yarnpkg
#8 1.828 npm ERR! EEXIST: file already exists
#8 1.828 npm ERR! File exists: /usr/local/bin/yarnpkg
#8 1.828 npm ERR! Remove the existing file and try again, or run npm
#8 1.828 npm ERR! with --force to overwrite files recklessly.
#8 1.830
#8 1.830 npm ERR! A complete log of this run can be found in:
#8 1.830 npm ERR! /root/.npm/_logs/2023-05-06T01_19_57_474Z-debug-0.log
------
Error: failed to fetch an image or build from source: error building: executor failed running [/bin/sh -c npm install -g yarn@$YARN_VERSION]: exit code: 1
FlyIo Dockerfile:
# syntax = docker/dockerfile:1
# Adjust NODE_VERSION as desired
ARG NODE_VERSION=18.15.0
FROM node:${NODE_VERSION}-slim as base
LABEL fly_launch_runtime="NodeJS"
# NodeJS app lives here
WORKDIR /app
# Set production environment
ENV NODE_ENV=production
ARG YARN_VERSION=1.22.19
RUN npm install -g yarn@$YARN_VERSION
# 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-is-python3 pkg-config build-essential
# Install node modules
COPY --link package.json yarn.lock .
RUN yarn install
# Copy application code
COPY --link . .
# 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
CMD [ "yarn", "run", "start" ]