Skip to content

Commit

Permalink
cleanup files
Browse files Browse the repository at this point in the history
  • Loading branch information
eibay committed May 28, 2021
1 parent 39720da commit 05d7d54
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ jobs:
go get -u golang.org/x/lint/golint
- name: Run build
run: |
echo ${{ github.workspace }}
docker build . --file Dockerfile --tag mygoapi:$(date +%s)
trigger-dev-deploy:
name: Trigger Dev Deployment
runs-on: ubuntu-18.04
Expand Down
13 changes: 7 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
FROM public.ecr.aws/lambda/provided:al2 as build
# install compiler
RUN yum install -y golang
RUN yum install -y git
RUN yum update -y \
&& yum install -y \
golang \
git \
bash \
&& yum clean all
RUN go env -w GOPROXY=direct
# cache dependencies
# ADD go.mod go.sum ./
ADD go.mod ./
RUN go mod download
# build
ADD . .
RUN go build -o /main
# copy artifacts to a clean image

FROM public.ecr.aws/lambda/provided:al2
COPY --from=build /main /main
ENTRYPOINT [ "/main" ]
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module github.com/eibay/mygo-api
module eibayan.com/goapi

go 1.15
11 changes: 1 addition & 10 deletions handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"encoding/json"
"log"
"net/http"
"os/exec"
)

type ApiHandler struct{}
Expand Down Expand Up @@ -43,7 +42,7 @@ func (ah *ApiHandler) handleMetadata(w http.ResponseWriter, r *http.Request) {
responseMetaData := ResponseMetadata{
Version: "1.0.777",
Description: "basic go-lang api service",
LastCommitSha: string(getSha()),
LastCommitSha: "oasdfkjqoewrpsdfklnvkjowo",
}

response, err := json.Marshal(&responseMetaData)
Expand All @@ -52,11 +51,3 @@ func (ah *ApiHandler) handleMetadata(w http.ResponseWriter, r *http.Request) {
}
w.Write(response)
}

func getSha() []byte {
sha, err := exec.Command("bash", "-c", "git rev-parse HEAD").Output()
if err != nil {
log.Fatal(err)
}
return sha
}
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
)

const (
host = "localhost"
host = "0.0.0.0"
port = "8080"
)

Expand Down

0 comments on commit 05d7d54

Please sign in to comment.