Skip to content

Commit

Permalink
ci: ignoring container-build-and-push step for now
Browse files Browse the repository at this point in the history
  • Loading branch information
nxtcoder17 committed Sep 17, 2024
1 parent 7dbf54d commit 0124a71
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
16 changes: 10 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ FROM nixos/nix:latest AS nix
WORKDIR /app
COPY . ./

RUN cat > /tmp/script.sh <<EOF
nix build .#container -o result
RUN cat > /tmp/script.sh <<'EOF'
nix --extra-experimental-features "nix-command flakes" build .#container -o result
tar cf result.tar result

mkdir -p /tmp/nix-store-closure
cp -R $(nix-store -qR result/) /tmp/nix-store-closure

Expand All @@ -19,7 +21,7 @@ RUN cat > /tmp/script.sh <<EOF
# tar cf - $tdir | zstd -12 --compress > tf.zst
tar cf - $tdir | zstd --compress > tf.zst
EOF
RUN nix --experimental-features "nix-command flakes" develop --command bash /tmp/script.sh
RUN nix --extra-experimental-features "nix-command flakes" develop --command bash /tmp/script.sh

FROM busybox:latest

Expand All @@ -36,9 +38,11 @@ WORKDIR /app

RUN mkdir -p /nix
COPY --from=nix /tmp/nix-store-closure /nix/store
COPY --from=nix /tmp/tf.zst /app/tf.zst
COPY --from=nix /app/result/bin/* /usr/local/bin/

COPY --from=nix /app/tf.zst /app/tf.zst
RUN mkdir -p /usr/local/bin
COPY --from=nix /app/result.tar /app/result.tar
RUN tar xf result.tar
RUN ls -al && mv result/bin/* /usr/local/bin/ && rm result.tar && rm -rf result
RUN adduser --disabled-password --home="/app" --uid 1717 nonroot
COPY --chown=nonroot ./terraform ./terraform
COPY --chown=nonroot ./infrastructure-templates ./infrastructure-templates
Expand Down
3 changes: 2 additions & 1 deletion Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ tasks:
vars:
push: true
cmds:
- docker buildx build -f Dockerfile --output=type=image,compression=zstd,force-compression=true,compression-level=22,push=true,oci-mediatypes=true -t {{.Image}} .
- echo "building and pushing {{.Image}}"
# - docker buildx build -f Dockerfile --output=type=image,compression=zstd,force-compression=true,compression-level=22,push=true,oci-mediatypes=true -t {{.Image}} .
# - docker build -f ./DockerfileNIX -t {{.Image}} . {{.dockerArgs}}
# - |+
# if [ "{{.push}}" == "true" ]; then
Expand Down
2 changes: 2 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@
# # custom
# packages.new-infra
# new-infra

zstd
];

shellHook = ''
Expand Down

0 comments on commit 0124a71

Please sign in to comment.