From aa51d402bdbf1885dd331931763ab4d5fb003014 Mon Sep 17 00:00:00 2001 From: David Barroso Date: Thu, 29 Aug 2024 16:31:42 +0200 Subject: [PATCH] chore: ci: standardize (#217) --- .github/workflows/build-docker-image.yaml | 91 --------------- .github/workflows/checks.yaml | 22 ++++ .../workflows/copy-docker-image-to-aws.yaml | 49 -------- .github/workflows/push.yaml | 10 -- .github/workflows/release.yaml | 33 +++--- .../{push_main.yaml => release_drafter.yaml} | 2 +- .github/workflows/test.yaml | 42 ------- .github/workflows/wf_build_artifacts.yaml | 106 ++++++++++++++++++ .github/workflows/wf_check.yaml | 73 ++++++++++++ .github/workflows/wf_docker_push_image.yaml | 104 +++++++++++++++++ Makefile | 56 +++++++-- VERSION | 1 - build/dev/docker/docker-compose.yaml | 2 +- build/nix-docker-image.sh | 4 +- flake.nix | 6 +- 15 files changed, 376 insertions(+), 225 deletions(-) delete mode 100644 .github/workflows/build-docker-image.yaml create mode 100644 .github/workflows/checks.yaml delete mode 100644 .github/workflows/copy-docker-image-to-aws.yaml delete mode 100644 .github/workflows/push.yaml rename .github/workflows/{push_main.yaml => release_drafter.yaml} (93%) delete mode 100644 .github/workflows/test.yaml create mode 100644 .github/workflows/wf_build_artifacts.yaml create mode 100644 .github/workflows/wf_check.yaml create mode 100644 .github/workflows/wf_docker_push_image.yaml delete mode 100644 VERSION diff --git a/.github/workflows/build-docker-image.yaml b/.github/workflows/build-docker-image.yaml deleted file mode 100644 index c9144f73..00000000 --- a/.github/workflows/build-docker-image.yaml +++ /dev/null @@ -1,91 +0,0 @@ ---- -name: Build containers - -on: - workflow_call: - secrets: - DOCKER_USERNAME: - required: true - DOCKER_PASSWORD: - required: true - CACHIX_AUTH_TOKEN: - required: true - -env: - CONTAINER_NAME: nhost/hasura-storage - -jobs: - docker-image: - runs-on: ubuntu-latest - - strategy: - fail-fast: true - matrix: - platform: [x86_64, aarch64] - - steps: - - name: Check out repository - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - uses: nixbuild/nix-quick-install-action@v28 - with: - nix_version: 2.20.5 - nix_conf: | - experimental-features = nix-command flakes - sandbox = false - - - name: Cache nix store - uses: actions/cache@v4 - with: - path: /nix - key: nix-build-${{ matrix.platform }}-${{ hashFiles('**/*.nix') }} - - - uses: cachix/cachix-action@v15 - with: - name: hasura-storage - authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} - - - uses: docker/setup-qemu-action@v3 - - - name: Login to DockerHub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - - - name: "Build docker image" - run: | - export VERSION=$(make get-version) - nix-build \ - --option system ${{ matrix.platform }}-linux \ - --extra-platforms ${{ matrix.platform }}-linux \ - -A packages.${{ matrix.platform }}-linux.dockerImage - docker load < result - docker tag hasura-storage:$VERSION $CONTAINER_NAME:$VERSION-${{ matrix.platform }} - docker push $CONTAINER_NAME:$VERSION-${{ matrix.platform }} - docker inspect $CONTAINER_NAME:$VERSION-${{ matrix.platform }} - - docker-manifest: - needs: docker-image - - runs-on: ubuntu-latest - - steps: - - name: Check out repository - uses: actions/checkout@v4 - - - name: Login to DockerHub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - - - run: | - export VERSION=$(make get-version) - docker manifest create \ - $CONTAINER_NAME:$VERSION \ - --amend $CONTAINER_NAME:$VERSION-x86_64 \ - --amend $CONTAINER_NAME:$VERSION-aarch64 - docker manifest push $CONTAINER_NAME:$VERSION diff --git a/.github/workflows/checks.yaml b/.github/workflows/checks.yaml new file mode 100644 index 00000000..06d14d15 --- /dev/null +++ b/.github/workflows/checks.yaml @@ -0,0 +1,22 @@ +--- +name: "check and build" +on: + pull_request: + push: + branches: + - main + +jobs: + tests: + uses: ./.github/workflows/wf_check.yaml + with: + NAME: hasura-storage + GIT_REF: ${{ github.event.pull_request.head.sha }} + + build_artifacts: + uses: ./.github/workflows/wf_build_artifacts.yaml + with: + NAME: hasura-storage + VERSION: 0.0.0-dev # hardcoded to avoid rebuilding + DOCKER: true + GIT_REF: ${{ github.event.pull_request.head.sha }} diff --git a/.github/workflows/copy-docker-image-to-aws.yaml b/.github/workflows/copy-docker-image-to-aws.yaml deleted file mode 100644 index b768c3c6..00000000 --- a/.github/workflows/copy-docker-image-to-aws.yaml +++ /dev/null @@ -1,49 +0,0 @@ ---- -name: Publish containers - -env: - CONTAINER_NAME: nhost/hasura-storage - -on: - workflow_call: - secrets: - AWS_ACCOUNT_ID: - required: true - -jobs: - push-docker-manifest-aws: - runs-on: ubuntu-latest - - permissions: - id-token: write - contents: write - - steps: - - name: Check out repository - uses: actions/checkout@v4 - - - name: Configure aws - uses: aws-actions/configure-aws-credentials@v4 - with: - role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/github-actions-nhost-${{ github.event.repository.name }} - aws-region: eu-central-1 - - - name: Login to Amazon ECR - uses: aws-actions/amazon-ecr-login@v2 - - - run: | - export VERSION=$(make get-version) - export ECR_CONTAINER_NAME=${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.$AWS_REGION.amazonaws.com/hasura-storage - - docker pull $CONTAINER_NAME:$VERSION-x86_64 - docker tag $CONTAINER_NAME:$VERSION-x86_64 $ECR_CONTAINER_NAME:$VERSION-x86_64 - docker push $ECR_CONTAINER_NAME:$VERSION-x86_64 - docker pull $CONTAINER_NAME:$VERSION-aarch64 - docker tag $CONTAINER_NAME:$VERSION-aarch64 $ECR_CONTAINER_NAME:$VERSION-aarch64 - docker push $ECR_CONTAINER_NAME:$VERSION-aarch64 - - docker manifest create \ - $ECR_CONTAINER_NAME:$VERSION \ - --amend $ECR_CONTAINER_NAME:$VERSION-x86_64 \ - --amend $ECR_CONTAINER_NAME:$VERSION-aarch64 - docker manifest push $ECR_CONTAINER_NAME:$VERSION diff --git a/.github/workflows/push.yaml b/.github/workflows/push.yaml deleted file mode 100644 index c5b2ff42..00000000 --- a/.github/workflows/push.yaml +++ /dev/null @@ -1,10 +0,0 @@ ---- -name: "push: Run tests and linters" -on: - - push - - pull_request -jobs: - tests: - uses: nhost/hasura-storage/.github/workflows/test.yaml@main - secrets: - CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }} diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 81fa453a..f3885726 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -6,20 +6,27 @@ on: jobs: tests: - uses: nhost/hasura-storage/.github/workflows/test.yaml@main - secrets: - CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }} + uses: ./.github/workflows/wf_check.yaml + with: + NAME: hasura-storage + + build_artifacts: + uses: ./.github/workflows/wf_build_artifacts.yaml + with: + NAME: hasura-storage + VERSION: ${{ github.ref_name }} + DOCKER: true - build: - needs: tests - uses: nhost/hasura-storage/.github/workflows/build-docker-image.yaml@main + push_docker_image: + uses: ./.github/workflows/wf_docker_push_image.yaml + needs: + - tests # we depend of tests here to paralleliza tests and build + - build_artifacts + with: + NAME: hasura-storage + VERSION: ${{ github.ref_name }} + AWS_REGION: eu-central-1 secrets: + AWS_ACCOUNT_ID: ${{ secrets.AWS_PRODUCTION_CORE_ACCOUNT_ID }} DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} - CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }} - - copy-to-aws-production: - needs: build - uses: nhost/hasura-storage/.github/workflows/copy-docker-image-to-aws.yaml@main - secrets: - AWS_ACCOUNT_ID: ${{ secrets.AWS_PRODUCTION_ACCOUNT_ID }} diff --git a/.github/workflows/push_main.yaml b/.github/workflows/release_drafter.yaml similarity index 93% rename from .github/workflows/push_main.yaml rename to .github/workflows/release_drafter.yaml index 17985efd..fc9a081e 100644 --- a/.github/workflows/push_main.yaml +++ b/.github/workflows/release_drafter.yaml @@ -1,5 +1,5 @@ --- -name: "main: Release drafter" +name: "Release drafter" on: push: branches: diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml deleted file mode 100644 index f70be60e..00000000 --- a/.github/workflows/test.yaml +++ /dev/null @@ -1,42 +0,0 @@ ---- -name: Run tests and linters - -on: - workflow_call: - secrets: - CACHIX_AUTH_TOKEN: - required: true - - -jobs: - tests: - runs-on: ubuntu-latest - steps: - - name: Check out repository - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - uses: nixbuild/nix-quick-install-action@v28 - with: - nix_version: 2.20.5 - nix_conf: | - experimental-features = nix-command flakes - sandbox = false - - - name: Cache nix store - uses: actions/cache@v4 - with: - path: /nix - key: nix-${{ runner.os }}-${{ hashFiles('**/*.nix') }} - - - uses: cachix/cachix-action@v15 - with: - name: hasura-storage - authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} - - - name: "Start containters for integration tests" - run: make dev-env-up - - - name: "Run checks" - run: make check diff --git a/.github/workflows/wf_build_artifacts.yaml b/.github/workflows/wf_build_artifacts.yaml new file mode 100644 index 00000000..bc5cac1a --- /dev/null +++ b/.github/workflows/wf_build_artifacts.yaml @@ -0,0 +1,106 @@ +--- +on: + workflow_call: + inputs: + NAME: + type: string + required: true + GIT_REF: + type: string + required: false + VERSION: + type: string + required: true + PATH: + type: string + default: "." + required: false + DOCKER: + type: boolean + required: true + +jobs: + artifacts: + # These permissions are needed to interact with GitHub's OIDC Token endpoint. + permissions: + id-token: write + contents: write + + strategy: + matrix: + os: [ubuntu-22.04, ubuntu-arm64-22.04-2cores] + fail-fast: true + + runs-on: ${{ matrix.os }} + timeout-minutes: 180 + + steps: + - name: "Check out repository" + uses: actions/checkout@v4 + with: + fetch-depth: 0 + ref: ${{ inputs.GIT_REF }} + + - uses: cachix/install-nix-action@v27 + with: + install_url: "https://releases.nixos.org/nix/nix-2.22.3/install" + install_options: "--no-daemon" + extra_nix_config: | + experimental-features = nix-command flakes + sandbox = false + access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} + substituters = https://cache.nixos.org/?priority=40 + trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= + + - uses: DeterminateSystems/magic-nix-cache-action@v7 + with: + diagnostic-endpoint: "" + use-flakehub: false + + - name: "Verify if we need to build" + id: verify-build + run: | + export drvPath=$(make check-dry-run) + echo "drvPath - $drvPath" + nix store verify --no-trust --store http://127.0.0.1:37515 $drvPath \ + && export BUILD_NEEDED=no \ + || export BUILD_NEEDED=yes + + echo BUILD_NEEDED=$BUILD_NEEDED >> $GITHUB_OUTPUT + echo DERIVATION_PATH=$drvPath >> $GITHUB_OUTPUT + + - name: Compute common env vars + id: vars + run: | + echo "VERSION=$(make get-version VER=${{ inputs.VERSION }})" >> $GITHUB_OUTPUT + + - name: "Build artifact" + run: | + make build + zip -r result.zip result + + - name: "Push artifact to artifact repository" + uses: actions/upload-artifact@v4 + with: + name: ${{ inputs.NAME }}-artifact-${{ matrix.os }}-${{ steps.vars.outputs.VERSION }} + path: result/bin/hasura-storage + retention-days: 7 + + - name: "Build docker image" + run: | + make build-docker-image + if: ${{ ( inputs.DOCKER ) }} + + - name: "Push docker image to artifact repository" + uses: actions/upload-artifact@v4 + with: + name: ${{ inputs.NAME }}-docker-image-${{ matrix.os }}-${{ steps.vars.outputs.VERSION }} + path: result + retention-days: 7 + if: ${{ ( inputs.DOCKER ) }} + + # - name: "Cache build environment" + # run: | + # # DEPENDENCIES=($(nix-store --query --requisites --include-outputs ${{ steps.verify-build.outputs.DERIVATION_PATH }})) + # nix copy --to http://127.0.0.1:37515 "${DEPENDENCIES[@]}" || exit 0 + # if: ${{ steps.verify-build.outputs.BUILD_NEEDED == 'yes' }} diff --git a/.github/workflows/wf_check.yaml b/.github/workflows/wf_check.yaml new file mode 100644 index 00000000..f23f66a0 --- /dev/null +++ b/.github/workflows/wf_check.yaml @@ -0,0 +1,73 @@ +--- +on: + workflow_call: + inputs: + NAME: + type: string + required: true + GIT_REF: + type: string + required: false + +jobs: + tests: + # These permissions are needed to interact with GitHub's OIDC Token endpoint. + permissions: + id-token: write + contents: write + + + runs-on: ubuntu-22.04 + timeout-minutes: 180 + + steps: + - name: "Check out repository" + uses: actions/checkout@v4 + with: + fetch-depth: 0 + ref: ${{ inputs.GIT_REF }} + + - uses: cachix/install-nix-action@v27 + with: + install_url: "https://releases.nixos.org/nix/nix-2.22.3/install" + install_options: "--no-daemon" + extra_nix_config: | + experimental-features = nix-command flakes + sandbox = false + access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} + substituters = https://cache.nixos.org/?priority=40 + trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= + + - uses: DeterminateSystems/magic-nix-cache-action@v7 + with: + diagnostic-endpoint: "" + use-flakehub: false + + - name: "Verify if we need to build" + id: verify-build + run: | + export drvPath=$(make check-dry-run) + echo "drvPath - $drvPath" + nix store verify --no-trust --store http://127.0.0.1:37515 $drvPath \ + && export BUILD_NEEDED=no \ + || export BUILD_NEEDED=yes + + echo BUILD_NEEDED=$BUILD_NEEDED >> $GITHUB_OUTPUT + echo DERIVATION_PATH=$drvPath >> $GITHUB_OUTPUT + + - name: "Start containters for integration tests" + run: | + make build-docker-image + nix develop -c make dev-env-up + if: ${{ steps.verify-build.outputs.BUILD_NEEDED == 'yes' }} + + - name: "Run checks" + run: make check + if: ${{ steps.verify-build.outputs.BUILD_NEEDED == 'yes' }} + + - name: "Cache checks" + run: | + # DEPENDENCIES=($(nix-store --query --requisites --include-outputs ${{ steps.verify-build.outputs.DERIVATION_PATH }})) + # nix copy --to http://127.0.0.1:37515 "${DEPENDENCIES[@]}" || exit 0 + nix copy --to http://127.0.0.1:37515 ${{ steps.verify-build.outputs.DERIVATION_PATH }}|| exit 0 + if: ${{ steps.verify-build.outputs.BUILD_NEEDED == 'yes' }} diff --git a/.github/workflows/wf_docker_push_image.yaml b/.github/workflows/wf_docker_push_image.yaml new file mode 100644 index 00000000..851d96fa --- /dev/null +++ b/.github/workflows/wf_docker_push_image.yaml @@ -0,0 +1,104 @@ +--- +on: + workflow_call: + inputs: + NAME: + type: string + required: true + VERSION: + type: string + required: true + AWS_REGION: + type: string + required: true + + secrets: + AWS_ACCOUNT_ID: + required: true + DOCKER_USERNAME: + required: true + DOCKER_PASSWORD: + required: true + +jobs: + push-to-ecr: + runs-on: ubuntu-latest + timeout-minutes: 30 + + permissions: + id-token: write + contents: write + + steps: + - name: "Check out repository" + uses: actions/checkout@v4 + with: + fetch-depth: 0 + submodules: true + + - name: "Compute common env vars" + id: vars + run: | + echo "VERSION=$(make get-version VER=${{ inputs.VERSION }})" >> $GITHUB_OUTPUT + + - name: "Configure aws" + uses: aws-actions/configure-aws-credentials@v4 + with: + role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/github-actions-nhost-${{ github.event.repository.name }} + aws-region: eu-central-1 + + - name: "Login to Amazon ECR" + uses: aws-actions/amazon-ecr-login@v2 + with: + mask-password: 'true' + + - name: "Get artifacts" + uses: actions/download-artifact@v4 + with: + path: ~/artifacts + + - name: "Push docker image to EKS" + run: | + export NAME=${{ inputs.NAME }} + export VERSION=${{ steps.vars.outputs.VERSION }} + export CONTAINER_REGISTRY=${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.${{ inputs.AWS_REGION }}.amazonaws.com + export CONTAINER_NAME=$CONTAINER_REGISTRY/$NAME + + for ARCH in "x86_64" "aarch64"; do + docker load < ~/artifacts/${{ inputs.NAME }}-docker-image-$ARCH-$VERSION/result + docker tag $NAME:$VERSION $CONTAINER_NAME:$VERSION-$ARCH + docker push $CONTAINER_NAME:$VERSION-$ARCH + done + + docker manifest create \ + $CONTAINER_NAME:$VERSION \ + --amend $CONTAINER_NAME:$VERSION-x86_64 \ + --amend $CONTAINER_NAME:$VERSION-aarch64 + + docker manifest push $CONTAINER_NAME:$VERSION + + - name: Login to DockerHub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: "Push docker image to docker hub" + run: | + export NAME=${{ inputs.NAME }} + export VERSION=${{ steps.vars.outputs.VERSION }} + export CONTAINER_REGISTRY=nhost + export CONTAINER_NAME=$CONTAINER_REGISTRY/$NAME + + for ARCH in "x86_64" "aarch64"; do + docker load < ~/artifacts/${{ inputs.NAME }}-docker-image-$ARCH-$VERSION/result + docker tag $NAME:$VERSION $CONTAINER_NAME:$VERSION-$ARCH + docker push $CONTAINER_NAME:$VERSION-$ARCH + done + + docker manifest create \ + $CONTAINER_NAME:$VERSION \ + --amend $CONTAINER_NAME:$VERSION-x86_64 \ + --amend $CONTAINER_NAME:$VERSION-aarch64 + + docker manifest push $CONTAINER_NAME:$VERSION diff --git a/Makefile b/Makefile index c71f4f64..887b5cb9 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,28 @@ +ifdef VER +VERSION=$(shell echo $(VER) | sed -e 's/^v//g' -e 's/\//_/g') +else +VERSION=$(shell grep -oP 'version\s*=\s*"\K[^"]+' flake.nix) +endif + +ifeq ($(shell uname -m),x86_64) + ARCH?=x86_64 +else ifeq ($(shell uname -m),arm64) + ARCH?=aarch64 +else ifeq ($(shell uname -m),aarch64) + ARCH?=aarch64 +else + ARCH?=FIXME-$(shell uname -m) +endif + +ifeq ($(shell uname -o),Darwin) + OS?=darwin +else + OS?=linux +endif + DEV_ENV_PATH=build/dev DOCKER_DEV_ENV_PATH=$(DEV_ENV_PATH)/docker GITHUB_REF_NAME?="0.0.0-dev" -VERSION=$(shell echo $(GITHUB_REF_NAME) | sed -e 's/^v//g' -e 's/\//_/g') .PHONY: help @@ -19,19 +40,22 @@ help: ## Show this help. .PHONY: get-version get-version: ## Return version - @echo $(VERSION) > VERSION + @sed -i "s/version\s*=\s*\"[^\"]*\"/version = \"${VERSION}\"/" flake.nix @echo $(VERSION) -.PHONY: tests -tests: dev-env-up check ## Spin environment and run nix flake check - - .PHONY: check check: ## Run nix flake check ./build/nix.sh flake check --print-build-logs +.PHONY: check-dry-run +check-dry-run: ## Run nix flake check + @nix path-info \ + --derivation \ + .\#checks.$(ARCH)-$(OS).go-checks + + .PHONY: integration-tests integration-tests: ## Run go test with integration flags @HASURA_AUTH_BEARER=$(shell make -s dev-jwt) \ @@ -43,28 +67,36 @@ integration-tests: ## Run go test with integration flags .PHONY: build build: ## Build application and places the binary under ./result/bin - @echo $(VERSION) > VERSION ./build/nix.sh build --print-build-logs +.PHONY: build-dry-run +build-dry-run: ## Run nix flake check + nix build \ + --dry-run \ + --json \ + --print-build-logs \ + .\#packages.$(ARCH)-$(OS).default + + .PHONY: build-docker-image build-docker-image: ## Build docker container for native architecture - @echo $(VERSION) > VERSION ./build/nix-docker-image.sh - docker tag hasura-storage:$(VERSION) hasura-storage:dev + docker tag hasura-storage:$(VERSION) nhost/hasura-storage:0.0.0-dev + .PHONY: build-docker-image-clamav-dev build-docker-image-clamav-dev: ## Build dev docker container for clamav @echo $(VERSION) > VERSION - ./build/nix-docker-image.sh clamavDockerImage + ./build/nix-docker-image.sh clamav-docker-image docker tag clamav:$(VERSION) clamav:dev .PHONY: build-docker-image-clamav build-docker-image-clamav: ## Build docker container for clamav @echo $(VERSION) > VERSION - ./build/nix-docker-image.sh clamavDockerImage aarch64-linux + ./build/nix-docker-image.sh clamav-docker-image aarch64-linux docker tag clamav:$(VERSION) nhost/clamav:$(VERSION)-aarch64 - ./build/nix-docker-image.sh clamavDockerImage x86_64-linux + ./build/nix-docker-image.sh clamav-docker-image x86_64-linux docker tag clamav:$(VERSION) nhost/clamav:$(VERSION)-x86_64 docker push nhost/clamav:$(VERSION)-aarch64 docker push nhost/clamav:$(VERSION)-x86_64 diff --git a/VERSION b/VERSION deleted file mode 100644 index cb676de1..00000000 --- a/VERSION +++ /dev/null @@ -1 +0,0 @@ -0.0.0-dev diff --git a/build/dev/docker/docker-compose.yaml b/build/dev/docker/docker-compose.yaml index 5d6ea72b..013d246c 100644 --- a/build/dev/docker/docker-compose.yaml +++ b/build/dev/docker/docker-compose.yaml @@ -44,7 +44,7 @@ services: storage: container_name: hasura-storage-storage - image: hasura-storage:dev + image: hasura-storage:0.0.0-dev depends_on: - graphql-engine restart: unless-stopped diff --git a/build/nix-docker-image.sh b/build/nix-docker-image.sh index f931f15d..0ea46dbe 100755 --- a/build/nix-docker-image.sh +++ b/build/nix-docker-image.sh @@ -2,7 +2,7 @@ which nix > /dev/null -IMAGE=${1:-"dockerImage"} +IMAGE=${1:-"docker-image"} SYSTEM=${2:-""} if [[ $NIX_BUILD_NATIVE -eq 1 ]]; then @@ -33,4 +33,4 @@ docker run --rm -it \ -w /build \ --entrypoint sh \ dbarroso/nix:2.6.0 \ - -c "nix build .\\#packages.$IMAGE --print-build-logs && docker load < result" + -c "nix build .\\#$IMAGE --print-build-logs && docker load < result" diff --git a/flake.nix b/flake.nix index 8cd4786a..d70d9fd6 100644 --- a/flake.nix +++ b/flake.nix @@ -73,7 +73,7 @@ ]; name = "hasura-storage"; - version = nixpkgs.lib.fileContents ./VERSION; + version = "0.0.0-dev"; module = "github.com/nhost/hasura-storage"; tags = [ "integration" ]; @@ -111,7 +111,7 @@ inherit name src version ldflags buildInputs nativeBuildInputs; }; - dockerImage = nixops-lib.go.docker-image { + docker-image = nixops-lib.go.docker-image { inherit name version buildInputs; package = hasuraStorage; @@ -124,7 +124,7 @@ }; }; - clamavDockerImage = pkgs.dockerTools.buildLayeredImage { + clamav-docker-image = pkgs.dockerTools.buildLayeredImage { name = "clamav"; tag = version; created = "now";