Skip to content

Commit

Permalink
update dockerfile and pipeline to use go mod
Browse files Browse the repository at this point in the history
  • Loading branch information
kahootali committed Nov 1, 2023
1 parent f3cee09 commit 144d0f4
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:

- name: Build Code
run: |
go get github.com/thedevsaddam/renderer/...
go mod download
go build -v .
- name: Generate Version
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:

- name: Build Code
run: |
go get github.com/thedevsaddam/renderer/...
go mod download
go build -v .
- name: Initialize Pipeline
Expand Down
11 changes: 6 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
FROM golang:1.20 as build

WORKDIR /app
RUN go env -w GO111MODULE=auto
RUN go get github.com/thedevsaddam/renderer/...
COPY go.mod go.sum .
RUN go mod download
COPY main.go .
RUN GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build main.go
COPY tpl ./tpl/
RUN CGO_ENABLED=0 go build main.go


FROM alpine
Expand All @@ -14,6 +15,6 @@ LABEL name="Golang Application" \
summary="A Golang Sample application"
WORKDIR /app
EXPOSE 8080
COPY --from=build ./app/main ./
COPY ./tpl ./tpl
COPY --from=build /app/main ./
COPY --from=build /app/tpl ./tpl
CMD ["./main"]
8 changes: 8 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module github.com/kahootali/golang-sample-app

go 1.20

require (
github.com/thedevsaddam/renderer v1.2.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
)
5 changes: 5 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
github.com/thedevsaddam/renderer v1.2.0 h1:+N0J8t/s2uU2RxX2sZqq5NbaQhjwBjfovMU28ifX2F4=
github.com/thedevsaddam/renderer v1.2.0/go.mod h1:k/TdZXGcpCpHE/KNj//P2COcmYEfL8OV+IXDX0dvG+U=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=

0 comments on commit 144d0f4

Please sign in to comment.