Skip to content

Commit

Permalink
feat: shrink container image size
Browse files Browse the repository at this point in the history
  • Loading branch information
kevincali committed Apr 20, 2024
1 parent 836989c commit b7e9586
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ jobs:
- name: checkout code
uses: actions/checkout@v4

- name: setup go
uses: actions/setup-go@v5
with:
go-version-file: go.mod

- name: build image
run: make build-image

Expand Down
8 changes: 3 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
FROM golang:alpine
FROM gcr.io/distroless/static:nonroot

COPY . .
COPY ./teamspeak-to-telegram /bin/teamspeak-to-telegram

RUN go build -o /teamspeak-to-telegram

ENTRYPOINT ["/teamspeak-to-telegram"]
ENTRYPOINT ["teamspeak-to-telegram"]
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
COMMIT_HASH := $(shell git --no-pager describe --tags --always --dirty)
build-image:
CGO_ENABLED=0 go build .
docker build --tag kevincali/teamspeak-to-telegram:$(COMMIT_HASH) --tag kevincali/teamspeak-to-telegram:latest .

run-image: build-image
docker run --env CONFIG_PATH=config.yaml kevincali/teamspeak-to-telegram:latest
docker run --volume ./config.yaml:/config.yaml --env CONFIG_PATH=/config.yaml kevincali/teamspeak-to-telegram:latest

push-image:
docker push kevincali/teamspeak-to-telegram:$(COMMIT_HASH)
Expand Down

0 comments on commit b7e9586

Please sign in to comment.