aksiksi / compose2nix

Generate a NixOS config from a Docker Compose project.
MIT License
306 stars 4 forks source link

Support for Compose Build spec #4

Open aksiksi opened 9 months ago

aksiksi commented 9 months ago

Here: https://docs.docker.com/compose/compose-file/build/

For a Git based build context, the generated Nix derivation needs to:

  1. Clone the repo (with a correct hash)
  2. Build a Docker imagee

This can be done using dockerTools.buildImage + fetchGit.

This would then be provided as an input to the generated container using imageFile.

Example of a Compose build service:

version: '3.5'
services:
  prefetcharr:
    build: https://github.com/p-hueber/prefetcharr.git
    image: prefetcharr
    environment:
      - JELLYFIN_URL=http://example.com/jellyfin
      - JELLYFIN_API_KEY=<YOUR KEY HERE>
      - SONARR_URL=http://example.com/sonarr
      - SONARR_API_KEY=<YOUR KEY HERE>
      - LOG_DIR=/log
      - RUST_LOG=prefetcharr=debug
    volumes:
      - /path/to/log/dir:/log
aksiksi commented 3 days ago

Another good candidate for this feature: https://github.com/ente-io/ente/tree/main/server#getting-started