Skip to content

Commit f51d80f

Browse files
authored
Initial commit
0 parents  commit f51d80f

File tree

6 files changed

+88
-0
lines changed

6 files changed

+88
-0
lines changed

.github/workflows/ci.yaml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: CI/CD
2+
on:
3+
push:
4+
branches:
5+
- main
6+
7+
jobs:
8+
build-image:
9+
name: Build and Push Docker images
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: read
13+
packages: write
14+
15+
outputs:
16+
image: ${{ steps.push-image.outputs.image }}
17+
steps:
18+
- name: Set up QEMU
19+
uses: docker/setup-qemu-action@v2
20+
- name: Set up Docker Buildx
21+
uses: docker/setup-buildx-action@v2
22+
- name: Login to image registry
23+
uses: docker/login-action@v2
24+
with:
25+
registry: ghcr.io
26+
username: ${{ github.actor }}
27+
password: ${{ secrets.DEPLOY_PAT }}
28+
- name: Build and push
29+
uses: docker/build-push-action@v3
30+
with:
31+
push: true
32+
tags: ghcr.io/${{ github.repository }}:${{ github.sha }}, ghcr.io/${{ github.repository }}:latest
33+
34+
# deploy-dev:
35+
# runs-on: ubuntu-latest
36+
# needs: build-image
37+
# steps:
38+
# - uses: imranismail/setup-kustomize@v1
39+
40+
# - name: Update env/dev image with Kustomize
41+
# run: |
42+
# git config --global user.name "Deploy Bot"
43+
# git config --global user.email "[email protected]"
44+
# git clone https://bot:${{ secrets.DEPLOY_PAT }}@github.com/${{ github.repository_owner }}/demo-app-deploy.git
45+
# cd demo-app-deploy/env/dev
46+
# kustomize edit set image ghcr.io/${{ github.repository_owner }}/demo-app:${{ github.sha }}
47+
# git commit -a -m "chore(dev): deploy demo-app:${{ github.sha }}"
48+
# git notes append -m "image: ghcr.io/${{ github.repository_owner }}/demo-app:${{ github.sha }}"
49+
# git push origin "refs/notes/*" --force && git push --force

Dockerfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
FROM golang:1.19.1 AS builder
2+
WORKDIR /go/src/app
3+
COPY . .
4+
RUN go build -o /go/bin/app
5+
6+
FROM gcr.io/distroless/base-debian10
7+
COPY --from=builder /go/bin/app /app
8+
ENTRYPOINT ["/app"]

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Demo Appication
2+
3+
Demo application is a simple Golang application that is used to demostrate how to integrate Argo CD driven GitOps process and CI.

go.mod

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module akuity/demo-app
2+
3+
go 1.19
4+
5+
require github.com/common-nighthawk/go-figure v0.0.0-20210622060536-734e95fb86be

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
github.com/common-nighthawk/go-figure v0.0.0-20210622060536-734e95fb86be h1:J5BL2kskAlV9ckgEsNQXscjIaLiOYiZ75d4e94E6dcQ=
2+
github.com/common-nighthawk/go-figure v0.0.0-20210622060536-734e95fb86be/go.mod h1:mk5IQ+Y0ZeO87b858TlA645sVcEcbiX6YqP98kt+7+w=

main.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package main
2+
3+
import (
4+
"fmt"
5+
"os"
6+
"time"
7+
8+
"github.com/common-nighthawk/go-figure"
9+
)
10+
11+
func main() {
12+
myFigure := figure.NewColorFigure("<username> is Awesome!!!", "larry3d", "yellow", true)
13+
myFigure.Print()
14+
15+
if secret := os.Getenv("SECRET"); secret != "" {
16+
mySecretFigure := figure.NewColorFigure(fmt.Sprintf("Secret value is: %s", secret), "larry3d", "red", true)
17+
mySecretFigure.Print()
18+
}
19+
20+
time.Sleep(10 * time.Hour)
21+
}

0 commit comments

Comments
 (0)