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: image: docker:stable stage: container script: - docker build . -t $CI_REGISTRY_IMAGE - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY - docker push $CI_REGISTRY_IMAGE