bldg14 / eventual

A simple event calendar
https://eventual-client.fly.dev
MIT License
0 stars 0 forks source link

Setup docker compose for local testing #48

Open kevinfalting opened 10 months ago

kevinfalting commented 10 months ago

Issue Description

I thought it might be nice to have a docker compose up option to run all of the services all at once. It will be especially useful once we have a database.

We have a couple of decision points:

  1. Run all services in docker.
  2. Only run dependencies that this repo does not contain the source code for.

I don't think we should try to develop from within a docker container, so in my opinion, option 2 would be best to make it simple to spin up any extra services we don't have control over. We can run the client and server from our own dev machines, no need to containerize them during development.

However, it may still be useful to be able to run all services in Docker, but this should be done under a profile that enables the build and running of the server and client images. The purpose of this is to build and test the containers in a close-to-production-ish (we shouldn't allow ourselves to be fooled here) way. Not to develop from within a docker container, ie: hot reloading or whatever, hot-reloading is taken care of for the client and there are some other ways to accomplish this for the server.

Note: This is not docker-compose

From July 2023 Compose V1 stopped receiving updates. It's also no longer available in new releases of Docker Desktop.

Supporting Documentation

Implementation Details

I started to play with it, but am running into issues getting the client to make requests to the server successfully. I didn't spend too much time on it, so here's the compose.yaml file where I stopped:

name: "eventual"
services:
  server:
    build:
      context: .
      dockerfile: Dockerfile.server
    pull_policy: build
    ports:
      - "8080:8080"
    command: ["-env", "local"]
  client:
    depends_on:
      - server
    build:
      context: .
      dockerfile: Dockerfile.client
      args:
        - BACKEND_URL="http://localhost:8080"
    pull_policy: build
    ports:
      - "3000:8080"

Acceptance Criteria