Skip to content

Commit

Permalink
Add Docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
paololazzari committed Oct 11, 2023
1 parent 323aed7 commit 24acdbf
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.dockerignore
.gitignore
21 changes: 21 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,24 @@ jobs:

- name: Build
run: go build -v ./...

ci:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build image
run: |
# Login dockerhub
pwd="${{ secrets.dockerhub }}"
docker login -u="plazzari" -p="${pwd}"
# Get version
VERSION=$(awk -F '[="]' '/^const version/ {print $3}' cmd/core.go)
# Build docker images
docker build . --tag "plazzari/play:${VERSION}"
docker tag "plazzari/play:${VERSION}" plazzari/play:latest
# Deploy docker images
docker push "plazzari/play:${VERSION}"
docker push plazzari/play:latest
9 changes: 9 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM alpine:3.18.4 as build
COPY --from=golang:1.21-alpine3.18 /usr/local/go/ /usr/local/go/
RUN GOBIN=/usr/local/bin/ /usr/local/go/bin/go install github.com/paololazzari/play@latest

FROM alpine:3.18.4 as main
RUN apk add --no-cache bash=5.2.15-r5 && rm -rf /var/cache/apk/*
COPY --from=build /usr/local/bin/play /usr/local/bin

ENTRYPOINT ["/usr/local/bin/play"]

0 comments on commit 24acdbf

Please sign in to comment.