Skip to content

Commit

Permalink
fix: werf to skaffold in CI (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
chabanyknikita authored Dec 4, 2024
1 parent b049709 commit bf848e7
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 81 deletions.
27 changes: 14 additions & 13 deletions .github/workflows/actions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,21 @@ jobs:
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
- 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 }}
27 changes: 14 additions & 13 deletions .github/workflows/tag.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,21 @@ jobs:
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.ref_name }}
repository: ghcr.io/${{ github.repository_owner }}
19 changes: 13 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
FROM golang:1.20-alpine as buildbase

RUN apk add git build-base
ARG CI_JOB_TOKEN

RUN apk add git build-base ca-certificates
WORKDIR /go/src/github.com/rarimo/proof-verification-relayer
COPY vendor .
COPY . .

RUN GOOS=linux go build -o /usr/local/bin/proof-verification-relayer /go/src/github.com/rarimo/proof-verification-relayer
RUN git config --global url."https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.com".insteadOf https://gitlab.com
RUN git config --global url."https://${CI_JOB_TOKEN}@github.com/".insteadOf https://github.com/
RUN go env -w GOPRIVATE=github.com/*,gitlab.com/*

RUN go mod tidy && go mod vendor
RUN CGO_ENABLED=1 GO111MODULE=on GOOS=linux go build -o /usr/local/bin/proof-verification-relayer /go/src/github.com/rarimo/proof-verification-relayer

FROM alpine:3.9
FROM scratch
COPY --from=alpine:3.9 /bin/sh /bin/sh
COPY --from=alpine:3.9 /usr /usr
COPY --from=alpine:3.9 /lib /lib

COPY --from=buildbase /usr/local/bin/proof-verification-relayer /usr/local/bin/proof-verification-relayer
RUN apk add --no-cache ca-certificates
COPY --from=buildbase /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/

ENTRYPOINT ["proof-verification-relayer"]
ENTRYPOINT ["proof-verification-relayer"]
8 changes: 8 additions & 0 deletions skaffold.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: skaffold/v2beta28
kind: Config
build:
artifacts:
- image: proof-verification-relayer
docker:
buildArgs:
CI_JOB_TOKEN: "{{.CI_JOB_TOKEN}}"
4 changes: 0 additions & 4 deletions werf-giterminism.yaml

This file was deleted.

45 changes: 0 additions & 45 deletions werf.yaml

This file was deleted.

0 comments on commit bf848e7

Please sign in to comment.