strapi / strapi-docker

Install and run your first Strapi project using Docker
https://strapi.io
MIT License
1.16k stars 447 forks source link

Strapi with docker-compose on Windows 10 #271

Closed Myrmod closed 3 years ago

Myrmod commented 3 years ago

Bug report

Describe the bug

I just recently heard of strapi. So I wanted to give it a try and started using docker-compose with mongodb locally.

After pulling there is an installation step. The package.json file doesn't seem to be correct though. It's missing the following dependencies:

// development
strapi-helper-plugin
style-loader
// production
sanitize.css
font-awesome

Steps to reproduce the behavior

  1. create a `docker-compose.yml shown in the [documentation(https://strapi.io/documentation/developer-docs/latest/installation/docker.html).
  2. run docker-compose up
  3. get error:
    strapi_1  | Building your admin UI with development configuration ...
    strapi_1  | ℹ Compiling Webpack
    strapi_1  | ✔ Webpack: Compiled successfully in 1.66m
    strapi_1  | [2021-01-31T09:59:34.124Z] debug ⛔️ Server wasn't able to start properly.
    strapi_1  | [2021-01-31T09:59:34.126Z] error Error: 'win32-x64' binaries cannot be used on the 'linux-x64' platform. Please remove the 'node_modules/sharp' directory and run 'npm install' on the 'linux-x64' platform.

Expected behavior

Using docker, when I create the docker-compose.yml. I want to be able to start the whole application on any machine with docker-compose up -d aand forgett about it, while developing.

Screenshots

folder structure after docker-compose up If applicable, add screenshots to help explain your problem.

Code snippets

docker-compose.yml:

version: '3'
services:
  strapi:
    image: strapi/strapi
    environment:
      DATABASE_CLIENT: mongo
      DATABASE_NAME: ${DB_NAME}
      DATABASE_HOST: mongo
      DATABASE_PORT: ${DB_PORT}
      DATABASE_USERNAME: ${DB_USER}
      DATABASE_PASSWORD: ${DB_PW}
    volumes:
      - ./app:/srv/app
    ports:
      - '1337:1337'
    depends_on:
      - mongo

  mongo:
    image: mongo
    environment:
      MONGO_INITDB_DATABASE: ${DB_NAME}
      MONGO_INITDB_ROOT_USERNAME: ${DB_USER}
      MONGO_INITDB_ROOT_PASSWORD: ${DB_PW}
    volumes:
      - ./data:/data/db

System

If I made any stupid mistakes I would be glad to be pointed in the right direction.

alexandrebodin commented 3 years ago

Hi @pgalle Can you tell me how you create the strapi application it looks like you installed the node_modules on windows once & then mount them on a linux container hence the issue. if you delete the modules folder & restart the container it should run the npm instalinside the container.

Let me know if this fixes your development setup :)

Myrmod commented 3 years ago

I guess I made a mistake. Starting this without anything around it works. It's slow but it works.

Thanks for your time. I gonna check out strapi now. So far it looks nice.