I want to launch a React/Node app via Dockerfile and MySQL db.
I got to this release command failed
release_command = “yarn knex migrate:latest”
I’m happy to become a paid customer and host multiple project if someone helps me with this app…
Error text
=> [internal] load .dockerignore 0.0s
=> [internal] load build context 89.2s
=> => transferring context: 647.99MB 89.2s
=> [base 1/3] FROM docker.io/library/node:17.3.0-slim@sha256:8f8a97163bed5b292bcd7a92a968 0.0s
=> CACHED [base 2/3] WORKDIR /app 0.0s
=> CACHED [base 3/3] RUN corepack enable && yarn set version 1.22.19 0.0s
=> CACHED [build 1/6] RUN apt-get update -qq && apt-get install -y build-essential pk 0.0s
=> [build 2/6] COPY --link .npmrc .yarnrc.yml package.json yarn.lock ./ 0.1s
=> ERROR [build 3/6] RUN yarn install --immutable --production=false 0.6s
------
> [build 3/6] RUN yarn install --immutable --production=false:
#0 0.551 node:internal/modules/cjs/loader:936
#0 0.551 throw err;
#0 0.551 ^
#0 0.551
#0 0.551 Error: Cannot find module '/app/.yarn/releases/yarn-3.5.1.cjs'
#0 0.551 at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
#0 0.551 at Function.Module._load (node:internal/modules/cjs/loader:778:27)
#0 0.551 at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
#0 0.551 at node:internal/main/run_main_module:17:47 {
#0 0.551 code: 'MODULE_NOT_FOUND',
#0 0.551 requireStack: []
#0 0.551 }
#0 0.551
#0 0.551 Node.js v17.3.0
------
Error: failed to fetch an image or build from source: error building: failed to solve: executor failed running [/bin/sh -c yarn install --immutable --production=false]: exit code: 1
Dockerfile
# syntax = docker/dockerfile:1
# Adjust NODE_VERSION as desired
ARG NODE_VERSION=17.3.0
FROM node:${NODE_VERSION}-slim as base
LABEL fly_launch_runtime="Node.js"
# Node.js app lives here
WORKDIR /app
# Set production environment
ENV NODE_ENV="production"
ARG YARN_VERSION=1.22.19
# Install Yarn 3
RUN corepack enable && \
yarn set version ${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 build-essential pkg-config python-is-python3
# Install node modules
COPY --link .npmrc .yarnrc.yml package.json yarn.lock ./
RUN yarn install --immutable --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" ]
fly.toml
# fly.toml app configuration file generated for home-project2 on 2023-11-16T23:55:50+01:00
#
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
#
app = "home-project2"
primary_region = "ams"
[build]
[http_service]
internal_port = 3000
force_https = true
auto_stop_machines = true
auto_start_machines = true
min_machines_running = 0
processes = ["app"]
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.