From 65b1c98c8e79bc0186591903792a658bd812a29d Mon Sep 17 00:00:00 2001 From: Kentaro1043 <71170923+Kentaro1043@users.noreply.github.com> Date: Fri, 13 Dec 2024 05:08:41 +0900 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Docker=E3=81=A7=E3=83=A9=E3=82=A4?= =?UTF-8?q?=E3=82=BB=E3=83=B3=E3=82=B9=E3=83=81=E3=82=A7=E3=83=83=E3=82=AF?= =?UTF-8?q?=E3=81=A7=E3=81=8D=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- exec-container/Dockerfile | 7 ++++--- exec-container/docker/build-in-docker.sh | 2 +- exec-container/license-check-in-docker.sh | 5 +++++ 3 files changed, 10 insertions(+), 4 deletions(-) create mode 100755 exec-container/license-check-in-docker.sh diff --git a/exec-container/Dockerfile b/exec-container/Dockerfile index 1898ee0..f8410a5 100644 --- a/exec-container/Dockerfile +++ b/exec-container/Dockerfile @@ -1,15 +1,16 @@ # hadolint ignore=DL3029 FROM --platform=amd64 nixos/nix:2.25.2 -# ワークスペースの作成 -RUN mkdir /workspace +# configの修正、ワークスペースの作成 +RUN echo "filter-syscalls = false" >> /etc/nix/nix.conf \ + && mkdir /workspace COPY . /workspace WORKDIR /workspace # ビルド成果物用の空ファイル作成 RUN touch /result \ # ビルドスクリプトの実行権限付与 - && chmod +x /workspace/build-in-docker.sh + && chmod +x /workspace/docker/build-in-docker.sh # ビルドキャッシュとビルド成果物 VOLUME [ "/nix/store", "/result" ] diff --git a/exec-container/docker/build-in-docker.sh b/exec-container/docker/build-in-docker.sh index 26cc669..d62acb7 100644 --- a/exec-container/docker/build-in-docker.sh +++ b/exec-container/docker/build-in-docker.sh @@ -1,7 +1,7 @@ #!/root/.nix-profile/bin/bash # コンテナビルド -if ! nix build --extra-experimental-features nix-command --extra-experimental-features flakes --option filter-syscalls false +if ! nix build --extra-experimental-features nix-command --extra-experimental-features flakes then exit 1 fi diff --git a/exec-container/license-check-in-docker.sh b/exec-container/license-check-in-docker.sh new file mode 100755 index 0000000..8106848 --- /dev/null +++ b/exec-container/license-check-in-docker.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +docker build -t trao-nix . +docker volume create trao-nix_cache +docker run -v ./result:/result -v trao-nix_cache:/nix/store trao-nix /workspace/license-check.sh