keystonejs / keystone

The superpowered headless CMS for Node.js — built with GraphQL and React
https://keystonejs.com
MIT License
9.18k stars 1.15k forks source link

Encountering Connection Timeout Issue in Docker Container on Server Without Internet Access #9073

Open sven0219 opened 6 months ago

sven0219 commented 6 months ago

Issue Description:

When running Keystone in a Docker container on a server without internet access, I encountered a connection timeout issue related to downloading openssl(I have installed openssl in Dokcerfile with RUN apt-get update -y && apt-get install -y openssl).

Steps to Reproduce:

  1. Build Docker image with the following Dockerfile
    
    FROM node:18 AS builder
    WORKDIR /src
    COPY package.json yarn.lock    /src/
    RUN yarn install --ignore-scripts
    COPY . /src

FROM node:18-slim RUN apt-get update -y && apt-get install -y openssl WORKDIR /app COPY --from=builder /src/ /app/ EXPOSE 3000 CMD [ "yarn", "dev" ]

2. Run the container in a server without internet access.
Error Message:

yarn run v1.22.19 $ concurrently "keystone dev" "npm run build:css" [1] [1] > keystone-app@1.0.2 build:css [1] > tailwindcss -i ./admin/styles/input.css -o ./admin/styles/output.css --watch [1] [1] [1] Rebuilding... [1] [1] Done in 265ms. [0] ✨ Starting Keystone [0] ⭐️ Server listening on 0.0.0.0:3000 (http://localhost:3000/) [0] ⭐️ GraphQL API available at /api/graphql [0] ✨ Generating GraphQL and Prisma schemas [0] FetchError: request to https://binaries.prisma.sh/all_commits/4bc8b6e1b66cb932731fb1bdbbc550d1e010de81/debian-openssl-3.0.x/migration-engine.sha256 failed, reason: connect ETIMEDOUT 172.67.4.173:443 [0] at ClientRequest. (/app/node_modules/@prisma/engines/dist/index.js:22625:14) [0] at ClientRequest.emit (node:events:517:28) [0] at ClientRequest.emit (node:domain:489:12) [0] at TLSSocket.socketErrorListener (node:_http_client:501:9) [0] at TLSSocket.emit (node:events:517:28) [0] at TLSSocket.emit (node:domain:489:12) [0] at emitErrorNT (node:internal/streams/destroy:151:8) [0] at emitErrorCloseNT (node:internal/streams/destroy:116:3) [0] at process.processTicksAndRejections (node:internal/process/task_queues:82:21) { [0] type: 'system', [0] errno: 'ETIMEDOUT', [0] code: 'ETIMEDOUT' [0] } [0] keystone dev exited with code 1

### Expected Behavior:
The application should run successfully in a Docker container even without internet access.

### Additional Information:
**package.json**
```json
{
  "name": "keystone-app",
  "version": "1.0.2",
  "private": true,
  "scripts": {
    "dev": "concurrently \"keystone dev\" \"npm run build:css\"",
    "start": "keystone start",
    "build": "keystone build",
    "postinstall": "keystone build --no-ui --frozen",
    "build:css": "tailwindcss -i ./admin/styles/input.css -o ./admin/styles/output.css --watch"
  },
  "dependencies": {
    "@keystone-6/auth": "^7.0.0",
    "@keystone-6/core": "^5.0.0",
    "@keystone-6/fields-document": "^7.0.0",
    "env-var": "^7.4.1",
    "typescript": "^4.9.5"
  },
  "devDependencies": {
    "autoprefixer": "^10.4.19",
    "concurrently": "^8.2.2",
    "postcss": "^8.4.38",
    "tailwindcss": "^3.4.1"
  }
}

Related issue https://github.com/prisma/prisma/issues/19729