Drift icon indicating copy to clipboard operation
Drift copied to clipboard

Create a docker-compose

Open MaxLeiter opened this issue 3 years ago • 3 comments

Server and client both have their respective Dockerfiles, which seem to work, but they can't communicate with one another.

MaxLeiter avatar Mar 08 '22 21:03 MaxLeiter

I made a rudimentary compose file...

version: '3.8'

services:
  server:
    build: ./server
    restart: unless-stopped
    user: 1000:1000
    environment:
      - "PORT=3000"
      - "JWT_SECRET=change_me!"

  client:
    build: ./client
    restart: unless-stopped
    user: 1000:1000
    depends_on:
      - server
    environment:
      - "API_URL=http://server:3000"
    ports:
      - "3748:3001"

...but they still can't talk to each other. From what I can tell, this is because API_URL=http://localhost:3000 in env.local gets baked in on build so setting it as a runtime env variable has no effect.

I just came across this article which may help?

I would try my hand at fixing this particular issue but I'm not familiar with NextJS so it'd probably take me a while 😅

reeseovine avatar Mar 09 '22 02:03 reeseovine

Thanks! I have a few ideas for improving the environment variables right now. Would you mind opening a PR with the docker-compose and I can add my changes that way?

MaxLeiter avatar Mar 09 '22 04:03 MaxLeiter

Done! #13

reeseovine avatar Mar 09 '22 06:03 reeseovine