Skip to content

Commit 20068b5

Browse files
committed
Use multi-stage docker build
1 parent 89dfc69 commit 20068b5

File tree

2 files changed

+10
-13
lines changed

2 files changed

+10
-13
lines changed

.github/workflows/release.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,6 @@ jobs:
5151
git tag v${{ steps.release-version.outputs.release_version }}
5252
git push https://Nikos410:${{ secrets.GITHUB_TOKEN }}@github.com/partyoffice/spotifete.git v${{ steps.release-version.outputs.release_version }}
5353
54-
- name: Set up Go
55-
uses: actions/setup-go@v2
56-
with:
57-
go-version: 1.17
58-
59-
- name: Build executable
60-
run: CGO_ENABLED=0 go build -v -o ./ ./...
61-
6254
- name: Login to Docker Hub
6355
uses: docker/login-action@v1
6456
with:

Dockerfile

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
1-
FROM alpine:3.14
1+
FROM golang:1.17-alpine AS builder
22

3-
WORKDIR /opt/spotifete
3+
WORKDIR /go/src/github.com/partyoffice/spotifete
4+
COPY . .
5+
6+
ENV CGO_ENABLED=0
7+
RUN go build -v -o ./ ./...
48

5-
COPY ./spotifete /opt/spotifete/spotifete
6-
COPY ./resources /opt/spotifete/resources
9+
FROM alpine:latest
710

11+
WORKDIR /opt/spotifete
12+
13+
COPY --from=builder /go/src/github.com/partyoffice/spotifete ./
814
RUN chmod +x /opt/spotifete/spotifete
915

1016
EXPOSE 8410
11-
1217
CMD ["/opt/spotifete/spotifete"]

0 commit comments

Comments
 (0)