-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: consumer ci and charts,deployments
- Loading branch information
Roman Morozov
committed
Jan 21, 2024
1 parent
50b5613
commit 0c876b2
Showing
7 changed files
with
152 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
name: Build and Push to GHCR | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- "**/consumer/**" | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build-and-push: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- name: Check Out Repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@v3 | ||
with: | ||
images: ghcr.io/${{ github.repository }}/consumer | ||
tags: | | ||
type=sha,prefix=commit,length=7 | ||
- name: Build and push to GHCR | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: packages/consumer | ||
file: ./Dockerfile | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
|
||
# - name: Build and push to GHCR | ||
# uses: docker/build-push-action@v2 | ||
# with: | ||
# context: packages/consumer | ||
# file: ./Dockerfile | ||
# push: true | ||
# tags: ghcr.io/${{ github.repository }}/consumer:latest | ||
|
||
# - name: Helm Deploy | ||
# uses: deliverybot/helm@v1 | ||
# with: | ||
# release: your-release | ||
# namespace: your-namespace | ||
# chart: ./helm-chart | ||
# values: ./helm-chart/values.yaml | ||
# token: ${{ secrets.KUBE_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
apiVersion: v2 | ||
name: go | ||
description: Go Web Application | ||
version: 1.0.0 | ||
type: application |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Start from the latest golang base image | ||
FROM golang:latest | ||
|
||
# Set the Current Working Directory inside the container | ||
WORKDIR /app | ||
|
||
# Copy go mod and sum files | ||
COPY go.mod go.sum ./ | ||
|
||
# Download all dependencies. Dependencies will be cached if the go.mod and go.sum files are not changed | ||
RUN go mod download | ||
|
||
# Copy the source from the current directory to the Working Directory inside the container | ||
COPY . . | ||
|
||
# Build the Go app | ||
RUN go build -o main . | ||
|
||
# Command to run the executable | ||
CMD ["./main"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{{ $fullname := include "app.fullname" . }} | ||
{{ $registry := .Values.image.registry }} | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: {{ $fullname }} | ||
spec: | ||
replicas: {{ .Values.replicaCount }} | ||
template: | ||
spec: {{ if and $registry.url $registry.username $registry.password }} | ||
imagePullSecrets: | ||
- name: {{ include "app.registry" . }} {{ else }} {{ with $imagePullSecrets := .Values.image.pullSecrets }} | ||
imagePullSecrets: {{ range $imagePullSecrets }} | ||
- name: {{ tpl . $ }} {{ end }} {{ end }} {{ end }} | ||
|
||
containers: | ||
- name: go-app | ||
image: {{ printf "%s/%s:%s" .Values.image.registry.url .Values.image.repository .Values.image.tag | quote }} | ||
env: | ||
- name: XPERM | ||
value: "1.2.3" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{{- define "app.name" -}} | ||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
|
||
{{- define "app.registry" -}} | ||
{{- printf "%s-%s" .Release.Name "registry" }} | ||
{{- end }} | ||
|
||
{{- define "app.fullname" -}} | ||
{{- if .Values.fullnameOverride }} | ||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} | ||
{{- else }} | ||
{{- $name := default .Chart.Name .Values.nameOverride }} | ||
{{- if contains $name .Release.Name }} | ||
{{- .Release.Name | trunc 63 | trimSuffix "-" }} | ||
{{- else }} | ||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{- define "app.chart" -}} | ||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
image: | ||
registry: | ||
url: ghcr.io/hiperbee | ||
username: "fromEnv" | ||
password: "fromEnv" | ||
repository: vortexia | ||
tag: 1.0.0 | ||
|
||
pullSecrets: [] | ||
|
||
replicaCount: 1 | ||
|
||
nameOverride: "" | ||
fullnameOverride: "" |