strapi-community / strapi-tool-dockerize

Easy add support for docker to your strapi project
MIT License
514 stars 35 forks source link

Volume must be a mapping, not an array. #28

Closed Florian-crg closed 1 year ago

Florian-crg commented 1 year ago

🐛 Bug Report

🤷‍♀️ What did you do

The CMD I did :

npx @strapi-community/dockerize new --dbclient=postgres --dbhost=localhost --dbport=5432 --dbname=remotly --dbusername=strapi --dbpassword=strapi --projecttype=ts --packagemanager=yarn --usecompose=true --env=both

Then changed few things, removing network and fixing small errors (removing container_name...)

⛔️ Error log

ERROR: In file './docker-compose.yml', volume must be a mapping, not an array.

🕵️‍♀️ Stack trace

Stack Trace

## 🙇‍♀️ Expected behavior/code

I expect it to run

## 👩‍💻 Environment

- 📦 Node version:
- 💻 OS: macos catalina

## 💡 Possible Solution

<!-- Only if you have suggestions on a fix for the bug -->

## 📺 Additional context/Screenshots

Docker-compose

version: "3"
services:
  test:
    container_name: test
    build: .
    image: :latest
    restart: unless-stopped
    env_file: .env
    environment:
      DATABASE_CLIENT: ${DATABASE_CLIENT}
      DATABASE_HOST: DB
      DATABASE_NAME: ${DATABASE_NAME}
      DATABASE_USERNAME: ${DATABASE_USERNAME}
      DATABASE_PORT: ${DATABASE_PORT}
      JWT_SECRET: ${JWT_SECRET}
      ADMIN_JWT_SECRET: ${ADMIN_JWT_SECRET}
      DATABASE_PASSWORD: ${DATABASE_PASSWORD}
      NODE_ENV: ${NODE_ENV}
    volumes:
      - ./config:/opt/app/config
      - ./src:/opt/app/src
      - ./package.json:/opt/package.json
      - ./yarn.lock:/opt/yarn.lock
      - ./.env:/opt/app/.env
      - ./public/uploads:/opt/app/public/uploads
    ports:
      - '1337:1337'
    depends_on:
      - DB

  DB:
    container_name: DB
    platform: linux/amd64 #for platform error on Apple M1 chips
    restart: unless-stopped
    env_file: .env
    image: postgres:12.0-alpine
    environment:
      POSTGRES_USER: ${DATABASE_USERNAME}
      POSTGRES_PASSWORD: ${DATABASE_PASSWORD}
      POSTGRES_DB: ${DATABASE_NAME}
    volumes:
      - ./data:/var/lib/postgresql/data/ #using a volume
    ports:
      - '5432:5432'

volumes:
  - data: {}
Eventyret commented 1 year ago

You set volume to be a folder not a volume.

I also think that volume can't be an empty object.