MaxLeiter / Drift

Drift is a self-hostable Gist and paste service. Built with Next.js 13 and React Server Components.
https://drift.lol
MIT License
1.36k stars 63 forks source link

Create a docker-compose #6

Open MaxLeiter opened 2 years ago

MaxLeiter commented 2 years ago

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

reeseovine commented 2 years ago

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 😅

MaxLeiter commented 2 years ago

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?

reeseovine commented 2 years ago

Done! #13