updating build-workflow and Dockerfile

only run on certain branches
This commit is contained in:
Tobias Lindberg
2021-12-23 10:58:47 +01:00
parent 843e41eb2d
commit 0701e31339
2 changed files with 7 additions and 4 deletions
+4 -1
View File
@@ -3,7 +3,9 @@ name: build
on:
push:
branches:
- "**"
- "main"
- "feature-*"
- "bug-*"
tags:
- "v*"
@@ -35,6 +37,7 @@ jobs:
${{ runner.os }}-buildx-
- name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v1.12.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
+3 -3
View File
@@ -14,7 +14,7 @@ RUN go mod download
COPY src/ .
# compile the program
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o TeslaMateApi .
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o app .
# get latest alpine container
@@ -27,10 +27,10 @@ RUN apk --no-cache add ca-certificates tzdata
WORKDIR /root/
# copy binary from first container
COPY --from=0 /go/src/TeslaMateApi .
COPY --from=0 /go/src/app .
# expose port 8080
EXPOSE 8080
# run application
CMD ["./TeslaMateApi"]
CMD ["./app"]