-
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.
- Loading branch information
0 parents
commit fc63ec6
Showing
11 changed files
with
631 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
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,52 @@ | ||
name: Mombo Goals CI | ||
|
||
# 1 | ||
# Controls when the workflow will run | ||
on: | ||
# Triggers the workflow on push events but only for the main branch | ||
push: | ||
branches: [main] | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: "Image version" | ||
required: true | ||
# 2 | ||
env: | ||
# REGISTRY: "AllanMombo/goal-accounts" | ||
IMAGE_NAME: "goal-accounts" | ||
TOKEN: ${{ secrets.GITHUB_TOKEN }} # it's needed for GH CLI | ||
|
||
#3 | ||
jobs: | ||
push_to_registry: | ||
name: Push Docker image to Docker Hub | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out the repo | ||
uses: actions/checkout@v3 | ||
|
||
- name: Log in to Docker Hub | ||
# uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 | ||
with: | ||
images: AllanMombo/goal-accounts | ||
|
||
- name: Build and push Docker image | ||
# uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
file: ./Dockerfile | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} |
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,2 @@ | ||
.env | ||
/tmp |
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,42 @@ | ||
# Start from golang base image | ||
FROM golang:alpine as builder | ||
|
||
# ENV GO111MODULE=on | ||
|
||
# Add Maintainer info | ||
LABEL maintainer="Allan Muiruri <allan@mombo.africa>" | ||
|
||
# Install git. | ||
# Git is required for fetching the dependencies. | ||
RUN apk update && apk add --no-cache git | ||
|
||
# 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 the go.sum files are not changed | ||
RUN go mod download && go mod verify | ||
|
||
# Copy the source from the current directory to the working Directory inside the container | ||
COPY . . | ||
|
||
# Build the Go app | ||
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o main . | ||
|
||
# Start a new stage from scratch | ||
FROM alpine:latest | ||
RUN apk --no-cache add ca-certificates | ||
|
||
WORKDIR /root/ | ||
|
||
# Copy the Pre-built binary file from the previous stage. Observe we also copied the .env file | ||
COPY --from=builder /app/main . | ||
# COPY --from=builder /app/.env . | ||
|
||
# Expose port 8080 to the outside world | ||
EXPOSE 3030 | ||
|
||
#Command to run the executable | ||
CMD ["./main"] |
Empty file.
Empty file.
Empty file.
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,27 @@ | ||
module github.com/AllanM007/lipa | ||
|
||
go 1.20 | ||
|
||
require ( | ||
dario.cat/mergo v1.0.0 // indirect | ||
github.com/bep/godartsass v0.16.0 // indirect | ||
github.com/bep/golibsass v1.1.0 // indirect | ||
github.com/cli/safeexec v1.0.0 // indirect | ||
github.com/cosmtrek/air v1.48.0 // indirect | ||
github.com/creack/pty v1.1.18 // indirect | ||
github.com/fatih/color v1.14.1 // indirect | ||
github.com/fsnotify/fsnotify v1.6.0 // indirect | ||
github.com/gohugoio/hugo v0.111.3 // indirect | ||
github.com/jinzhu/inflection v1.0.0 // indirect | ||
github.com/jinzhu/now v1.1.5 // indirect | ||
github.com/mattn/go-colorable v0.1.13 // indirect | ||
github.com/mattn/go-isatty v0.0.17 // indirect | ||
github.com/pelletier/go-toml v1.9.5 // indirect | ||
github.com/pelletier/go-toml/v2 v2.0.6 // indirect | ||
github.com/spf13/afero v1.9.3 // indirect | ||
github.com/tdewolff/parse/v2 v2.6.5 // indirect | ||
golang.org/x/sys v0.5.0 // indirect | ||
golang.org/x/text v0.7.0 // indirect | ||
google.golang.org/protobuf v1.31.0 // indirect | ||
gorm.io/gorm v1.25.5 // indirect | ||
) |
Large diffs are not rendered by default.
Oops, something went wrong.
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,9 @@ | ||
package main | ||
|
||
import "fmt" | ||
|
||
|
||
|
||
func main() { | ||
fmt.Println("This is the main function!!") | ||
} |
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,6 @@ | ||
syntax = "proto3"; | ||
|
||
service ProductManagement { | ||
rpc GetProduct(ProductRequest) returns (ProductResponse); | ||
rpc UpdateStock(StockUpdateRequest) returns (StockUpdateResponse); | ||
} |