0

I am trying to execute formio with docker-compose, but the application is wrong.

services:
  mongo:
    image: mongo:4.2
    restart: always
    volumes:
      - mdb-data:/data/db
    networks:
      - app-mongo
    ports:
      - '27017:27017'
    environment:
      MONGO_INITDB_ROOT_USERNAME:
      MONGO_INITDB_ROOT_PASSWORD:

  formio:
    build: ./
    restart: always
    links:
      - mongo
    ports:
      - '3001:3001'
    volumes:
      - ./:/app:rw
    networks:
      - app-mongo
    environment:
      DEBUG: formio:*
      NODE_CONFIG: '{"mongo": "mongodb://mongo:27017/formio"}'
      ROOT_EMAIL: admin@example.com
      ROOT_PASSWORD: CHANGEME
    stdin_open: true  # -i
    tty: true         # -t

when i execute localhost:3001 - show me the wrong message:

TypeError: Could not connect to API server (Failed to fetch)

How to executed form.io with docker-compose?

Thanks

Xirehat
  • 1,155
  • 1
  • 8
  • 20
  • It's better to add fromio Dockerfile content in your question. – Xirehat Mar 28 '23 at 14:59
  • FROM node:lts-alpine3.10 WORKDIR /app RUN apk update && \ apk upgrade && \ apk add make=4.2.1-r2 && \ apk add g++=8.3.0-r0 RUN apk --update add git RUN git config --global url."https://github.com/".insteadOf "ssh://git@github.com/" – João Paulo Sapi de Paula Mar 28 '23 at 17:44
  • ENV NPM_PACKAGES=/.npm-packages \ PATH=$NPM_PACKAGES/bin:$PATH \ NODE_PATH=$NPM_PACKAGES/lib/node_modules:$NODE_PATH RUN echo "prefix = $NPM_PACKAGES" >> ~/.npmrc COPY ./package.json $NPM_PACKAGES/ COPY ./package-lock.json $NPM_PACKAGES/ RUN npm ci --prefix=$NPM_PACKAGES RUN apk del git RUN ln -sf $NPM_PACKAGES/node_modules node_modules ENV DEBUG="" ENTRYPOINT [ "node", "main" ] – João Paulo Sapi de Paula Mar 28 '23 at 17:45
  • Step 8/14 : COPY ./package.json $NPM_PACKAGES/ ---> Using cache ---> 031cb2990d84 Step 9/14 : COPY ./package-lock.json $NPM_PACKAGES/ COPY failed: file not found in build context or excluded by .dockerignore: stat package-lock.json: file does not exist ERROR: Service 'formio' failed to build : Build failed – João Paulo Sapi de Paula Mar 28 '23 at 17:45
  • above is the code dockerfile and wrong message after execute docker-compose up -d – João Paulo Sapi de Paula Mar 28 '23 at 17:46

0 Answers0