summary refs log tree commit diff
diff options
context:
space:
mode:
authorPaweł Dybiec <pawel@dybiec.info>2023-08-22 22:42:01 +0100
committerPaweł Dybiec <pawel@dybiec.info>2023-08-22 23:01:18 +0100
commit0331baa522f75aa049f5b2a73ac50c120a13e175 (patch)
treec2b99f1017709a3f300ea3ceee0ddb22fd42f447
parentNix config (diff)
Use nix for docker builds
-rw-r--r--.gitlab-ci.yml34
1 files changed, 10 insertions, 24 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 8b97ff3..c680d0b 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,30 +1,16 @@
 stages:
-  - build
-  - container
-
-build_and_test:
-  image: rust:alpine3.16
-  variables:
-    CARGO_HOME: ${CI_PROJECT_DIR}/.cargo
-  cache:
-      key: $CI_COMMIT_REF_SLUG
-      paths:
-      - target/
-      - .cargo/bin
-      - .cargo/registry/index
-      - .cargo/registry/cache
-
-  stage: build
-  before_script:
-    - apk add openssl openssl-dev musl-dev sqlite
-  script:
-    - cargo build
-    - cargo test
-container:
+  - nix
+nix:
   image: docker:stable
-  stage: container
+  stage: nix
   script:
-  - docker build . -t $CI_REGISTRY_IMAGE
+  - apk add curl git
+  - curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install linux --extra-conf "sandbox = false" --init none --no-confirm
+  - export PATH="${PATH}:/nix/var/nix/profiles/default/bin"
+  - nix flake check
+  - nix build .#dockerImage
+  - ./result | docker load
+  - docker tag vavbot $CI_REGISTRY_IMAGE
   - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD  $CI_REGISTRY
   - docker push $CI_REGISTRY_IMAGE