diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index d0c5b52f..d5122f0a 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -4,29 +4,29 @@ on: jobs: converge: - name: Converge - runs-on: ubuntu-latest + name: Skaffold Build Manual + runs-on: ubuntu-22.04 steps: - - name: Checkout code uses: actions/checkout@v3 with: fetch-depth: 0 - - name: Install werf - uses: werf/actions/install@v1.2 - - name: Log in to registry # This is where you will update the personal access token to GITHUB_TOKEN run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin - - name: Run echo - run: | - werf version - docker version - echo $GITHUB_REPOSITORY - echo $GITHUB_SHA - - name: Run Build - run: | - . $(werf ci-env github --as-file) - werf export service --tag ghcr.io/$GITHUB_REPOSITORY:$GITHUB_SHA \ No newline at end of file + - name: Cache layers + uses: actions/cache@v3 + with: + path: "${{ github.workspace }}/.skaffold/cache" + key: skaffold-${{ hashFiles('**/cache') }} + restore-keys: | + skaffold- + + - name: Run Skaffold pipeline as command + uses: hiberbee/github-action-skaffold@latest + id: build + with: + command: build --tag ${{ github.sha }} + repository: ghcr.io/${{ github.repository_owner }} \ No newline at end of file diff --git a/.github/workflows/actions_onlymain.yml b/.github/workflows/actions_onlymain.yml index a65bd4bc..f4eb54e4 100644 --- a/.github/workflows/actions_onlymain.yml +++ b/.github/workflows/actions_onlymain.yml @@ -9,29 +9,29 @@ on: jobs: converge: - name: Converge - runs-on: ubuntu-latest + name: Skaffold Build Only Main + runs-on: ubuntu-22.04 steps: - - name: Checkout code uses: actions/checkout@v3 with: fetch-depth: 0 - - name: Install werf - uses: werf/actions/install@v1.2 - - name: Log in to registry # This is where you will update the personal access token to GITHUB_TOKEN run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin - - name: Run echo - run: | - werf version - docker version - echo $GITHUB_REPOSITORY - echo $GITHUB_SHA - - name: Run Build - run: | - . $(werf ci-env github --as-file) - werf export service --tag ghcr.io/$GITHUB_REPOSITORY:$GITHUB_SHA \ No newline at end of file + - name: Cache layers + uses: actions/cache@v3 + with: + path: "${{ github.workspace }}/.skaffold/cache" + key: skaffold-${{ hashFiles('**/cache') }} + restore-keys: | + skaffold- + + - name: Run Skaffold pipeline as command + uses: hiberbee/github-action-skaffold@latest + id: build + with: + command: build --tag ${{ github.sha }} + repository: ghcr.io/${{ github.repository_owner }} \ No newline at end of file diff --git a/.github/workflows/tag.yml b/.github/workflows/tag.yml index f8bcd127..422ff7c6 100644 --- a/.github/workflows/tag.yml +++ b/.github/workflows/tag.yml @@ -8,32 +8,32 @@ on: jobs: converge: - name: Converge - runs-on: ubuntu-latest + name: Skaffold Build For Tag + runs-on: ubuntu-22.04 steps: - name: Checkout code uses: actions/checkout@v3 with: fetch-depth: 0 - - name: Install werf - uses: werf/actions/install@v1.2 - - name: Log in to registry # This is where you will update the personal access token to GITHUB_TOKEN run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin - - name: Run echo - run: | - werf version - docker version - echo $GITHUB_REPOSITORY - echo $GITHUB_REF_NAME - - - name: Run Build - run: | - . $(werf ci-env github --as-file) - werf export service --tag ghcr.io/$GITHUB_REPOSITORY:$GITHUB_REF_NAME + - name: Cache layers + uses: actions/cache@v3 + with: + path: "${{ github.workspace }}/.skaffold/cache" + key: skaffold-${{ hashFiles('**/cache') }} + restore-keys: | + skaffold- + + - name: Run Skaffold pipeline as command + uses: hiberbee/github-action-skaffold@latest + id: build + with: + command: build --tag ${{ github.sha }} + repository: ghcr.io/${{ github.repository_owner }} - uses: shrink/actions-docker-extract@v3 id: extract diff --git a/werf.yaml b/.werf.yaml similarity index 100% rename from werf.yaml rename to .werf.yaml diff --git a/Dockerfile b/Dockerfile index c2ab6b3f..19191281 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,19 +2,12 @@ FROM golang:1.20-alpine as buildbase RUN apk add build-base git -ARG CI_JOB_TOKEN - WORKDIR /go/src/github.com/rarimo/rarimo-core ENV GO111MODULE="on" ENV CGO_ENABLED=1 ENV GOOS="linux" -ENV GOPRIVATE=gitlab.com/* -ENV GONOSUMDB=gitlab.com/* -ENV GONOPROXY=gitlab.com/* -RUN echo "machine gitlab.com login gitlab-ci-token password $CI_JOB_TOKEN" > ~/.netrc -# RUN git config --global url."https://gitlab-ci-token:$CI_JOB_TOKEN@gitlab.com/".insteadOf https://gitlab.com/ COPY go.mod . COPY go.sum . RUN go mod download @@ -22,17 +15,17 @@ RUN go mod download COPY . . RUN go mod vendor +# TODO switch to latest cosmosvisor +RUN go install cosmossdk.io/tools/cosmovisor/cmd/cosmovisor@v1.5.0 -RUN go build -o /usr/local/bin/rarimo-core github.com/rarimo/rarimo-core/cmd/rarimo-cored - - - -### +RUN cp $GOPATH/bin/cosmovisor /usr/local/bin/cosmovisor +RUN go build -mod=mod -o /usr/local/bin/rarimo-core github.com/rarimo/rarimo-core/cmd/rarimo-cored FROM alpine:3.9 RUN apk add --no-cache ca-certificates COPY --from=buildbase /usr/local/bin/rarimo-core /usr/local/bin/rarimo-core +COPY --from=buildbase /usr/local/bin/cosmovisor /usr/local/bin/cosmovisor ENTRYPOINT ["rarimo-core"] diff --git a/skaffold.yaml b/skaffold.yaml new file mode 100644 index 00000000..ae5c7172 --- /dev/null +++ b/skaffold.yaml @@ -0,0 +1,5 @@ +apiVersion: skaffold/v2beta28 +kind: Config +build: + artifacts: + - image: rarimo-core \ No newline at end of file