mirror of
https://github.com/tobiasehlert/teslamateapi.git
synced 2026-02-27 09:54:18 +08:00
updating build-workflow and Dockerfile
only run on certain branches
This commit is contained in:
@@ -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
@@ -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"]
|
||||
|
||||
Reference in New Issue
Block a user