Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 use symlinkJoin and nix-filter #36

Merged
merged 1 commit into from
Oct 19, 2024
Merged

Conversation

comavius
Copy link
Member

close #34
symlinkJoinとnix-filterを使った実装に変更

@comavius comavius added the bug Something isn't working label Oct 17, 2024
@comavius comavius requested a review from zer0-star October 17, 2024 06:35
@comavius comavius self-assigned this Oct 17, 2024
@comavius
Copy link
Member Author

@zer0-star レビューお願いします

@mtaku3 mtaku3 self-assigned this Oct 17, 2024
@comavius comavius requested review from H1rono and mtaku3 October 17, 2024 09:18
Copy link

@zer0-star zer0-star left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

良さそうな気がする

@mtaku3
Copy link
Contributor

mtaku3 commented Oct 19, 2024

根本的なところなんですが、Docker周りの実装であったらpkgs.dockerToolsを使うのはどうでしょうか?

let
  pkgs = import (builtins.fetchTarball {
    # テスト通過してるnixpkgs-unstableをPINして使う
    url = "https://github.com/nixos/nixpkgs/archive/ccc0c2126893dd20963580b6478d1a10a4512185.tar.gz";
  }) {};
in
  # https://nixos.org/manual/nixpkgs/stable/#ssec-pkgs-dockerTools-buildImage
  # nixosのDockerイメージビルドツールを使う
  pkgs.dockerTools.buildImage {
    name = "exec-container";
    tag = "latest";

    # 必要なパッケージを列挙
    copyToRoot = let
      python311 = pkgs.python311.withPackages (ps:
        with ps; [
          numpy
          scipy
          networkx
          sympy
          sortedcontainers
          more-itertools
          shapely
          bitarray
          pulp
          mpmath
          pandas
          z3-solver
          scikit-learn
        ]);
      python312 = pkgs.python312.withPackages (ps:
        with ps; [
          numpy
          scipy
          networkx
          sympy
          sortedcontainers
          more-itertools
          shapely
          bitarray
          pulp
          mpmath
          pandas
          z3-solver
          scikit-learn
        ]);
    in [
      (pkgs.writeShellScriptBin "python3.11" "${python311}/bin/python")
      (pkgs.writeShellScriptBin "python3.12" "${python312}/bin/python")
    ];
  }

pkgs.dockerToolsだと
image

現状のDockerfileだと
image

というところでイメージサイズも大分削れそうです。

@comavius
Copy link
Member Author

@mtaku3 ありがとうございます!issue建てました
#108

@comavius
Copy link
Member Author

@mtaku3 これは一旦マージして、flake.nixを別prでdockertoolsを使った実装に書き換えようと思うのですが、flake.nix以外の部分はこれで大丈夫そうですか?

@comavius comavius merged commit 6c64f52 into develop Oct 19, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SymlinkJoinに変更
3 participants