Skip to content

Commit

Permalink
Merge pull request #2 from mxyng/container
Browse files Browse the repository at this point in the history
docker
  • Loading branch information
mxyng authored Aug 10, 2024
2 parents 8dafd13 + 68418cc commit 6b4fd2a
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
on:
workflow_dispatch:
push:
branches:
- 'main'
tags:
- 'v*'
pull_request:
branches:
- 'main'

jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- id: metadata
uses: docker/metadata-action@v4
with:
images: |
ghcr.io/mxyng/termhnal
mxyng/termhnal
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha,prefix=
type=edge
- if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
username: ${{ env.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: docker/setup-buildx-action@v2
- uses: docker/setup-qemu-action@v2
- uses: docker/build-push-action@v4
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.metadata.outputs.tags }}
labels: ${{ steps.metadata.outputs.labels }}
platforms: linux/amd64,linux/arm64
cache-from: type=registry,ref=ghcr.io/mxyng/termhnal:edge
cache-to: type=inline
16 changes: 16 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
on:
pull_request:
branches:
- 'main'

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: 'stable'
- uses: golangci/golangci-lint-action@v6
with:
args: -v
14 changes: 14 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM golang:alpine

WORKDIR /go/src/github.com/mxyng/termhnal

COPY go.* .
RUN go mod download

COPY . .
RUN go build -o termhnal

FROM alpine
ENV TERM=xterm-256color
COPY --from=0 /go/src/github.com/mxyng/termhnal/termhnal /usr/bin/termhnal
ENTRYPOINT ["/usr/bin/termhnal"]

0 comments on commit 6b4fd2a

Please sign in to comment.