Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

migrate ci to skaffold #25

Merged
merged 2 commits into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 17 additions & 17 deletions .github/workflows/actions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,29 @@ on:

jobs:
converge:
name: Converge
runs-on: ubuntu-latest
steps:

name: Skaffold Build To Github
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Install werf
uses: werf/actions/[email protected]

- 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 }}
34 changes: 17 additions & 17 deletions .github/workflows/tag.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,29 @@ on:

jobs:
converge:
name: Converge
runs-on: ubuntu-latest
steps:

name: Skaffold Build To Github
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Install werf
uses: werf/actions/[email protected]

- 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: 11 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
FROM golang:1.22-alpine as buildbase

RUN apk add git build-base
RUN apk add git build-base ca-certificates

WORKDIR /go/src/github.com/rarimo/geo-points-svc
COPY vendor .
COPY . .
RUN go mod tidy && go mod vendor
RUN CGO_ENABLED=1 GO111MODULE=on GOOS=linux go build -o /usr/local/bin/geo-points-svc /go/src/github.com/rarimo/geo-points-svc

RUN GOOS=linux go build -o /usr/local/bin/geo-points-svc /go/src/github.com/rarimo/geo-points-svc


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/geo-points-svc /usr/local/bin/geo-points-svc
RUN apk add --no-cache ca-certificates
COPY --from=buildbase /go/src/github.com/rarimo/geo-points-svc/proof_keys/passport.json /proof_keys/passport.json
COPY --from=buildbase /go/src/github.com/rarimo/geo-points-svc/proof_keys/poll.json /proof_keys/poll.json
COPY --from=buildbase /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/

ENTRYPOINT ["geo-points-svc"]
ENTRYPOINT ["geo-points-svc"]
72 changes: 72 additions & 0 deletions skaffold.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
apiVersion: skaffold/v2beta28
kind: Config
build:
artifacts:
- image: geo-points-svc # Change it on your own repo-name

# Uncomment the following lines if you want to deploy your application
# profiles:
# - name: dev
# deploy:
# helm:
# releases:
# - name: backend # Change it on your own repo-name
# setValueTemplates:
# image.repository: "{{.IMAGE_REPO_backend}}"
# image.tag: "{{.IMAGE_TAG_backend}}"
# namespace: dev # Change it on your own namespace
# createNamespace: true
# chartPath: ./backend # Change it on your own path to helm chart
# valuesFiles:
# - ./backend/values.yaml # Change it on your own path to helm chart values.yaml file
# skipBuildDependencies: true
# flags:
# upgrade:
# - -i
# portForward:
# - resourceType: deployment
# resourceName: backend # Change it on your own name in Chart.yaml
# port: 8000
# localPort: 8000

# - name: stage
# patches:
# - op: remove
# path: /build
# deploy:
# helm:
# releases:
# - name: backend # Change it on your own repo-name
# setValueTemplates:
# image.repository: "{{.SKAFFOLD_DEFAULT_REPO}}/{{.GITHUB_REPOSITORY}}"
# image.tag: "{{.GITHUB_SHA}}"
# namespace: stage # Change it on your own namespace
# createNamespace: true
# chartPath: ./backend # Change it on your own path to helm chart
# valuesFiles:
# - ./backend/values.yaml # Change it on your own path to helm chart values.yaml file
# skipBuildDependencies: true
# flags:
# upgrade:
# - -i

# - name: prod
# patches:
# - op: remove
# path: /build
# deploy:
# helm:
# releases:
# - name: backend # Change it on your own repo-name
# setValueTemplates:
# image.repository: "{{.SKAFFOLD_DEFAULT_REPO}}/{{.GITHUB_REPOSITORY}}"
# image.tag: "{{.GITHUB_REF_NAME}}"
# namespace: prod # Change it on your own namespace
# createNamespace: true
# chartPath: ./backend # Change it on your own path to helm chart
# valuesFiles:
# - ./backend/values.yaml # Change it on your own path to helm chart values.yaml file
# skipBuildDependencies: true
# flags:
# upgrade:
# - -i
53 changes: 0 additions & 53 deletions werf.yaml

This file was deleted.

Loading