Skip to content

Commit e11cd62

Browse files
committed
Initial commit
0 parents  commit e11cd62

File tree

17 files changed

+377
-0
lines changed

17 files changed

+377
-0
lines changed

.dockerignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
go.work
2+
.gitignore
3+
.git
4+
.idea
5+
.dockerignore
6+
Dockerfile
7+
kvitto-tcp
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Build
2+
on:
3+
push:
4+
branches:
5+
- master
6+
tags:
7+
- '*'
8+
9+
env:
10+
REGISTRY: ghcr.io
11+
IMAGE_NAME: ${{ github.repository }}
12+
13+
jobs:
14+
docker:
15+
runs-on: ubuntu-latest
16+
permissions:
17+
contents: read
18+
packages: write
19+
steps:
20+
- name: Login to GitHub Container Registry
21+
uses: docker/login-action@v3
22+
with:
23+
registry: ghcr.io
24+
username: ${{ github.actor }}
25+
password: ${{ secrets.GITHUB_TOKEN }}
26+
- name: Extract metadata (tags, labels) for Docker
27+
id: meta
28+
uses: docker/metadata-action@v5
29+
with:
30+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
31+
tags: |
32+
# set latest tag for default branch
33+
type=raw,value=latest,enable={{is_default_branch}}
34+
type=semver,pattern={{version}}
35+
- name: Build container
36+
uses: docker/build-push-action@v5
37+
with:
38+
push: true
39+
tags: ${{ steps.meta.outputs.tags }}
40+
labels: ${{ steps.meta.outputs.labels }}
41+

.github/workflows/verify-code.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: verify-code
2+
on:
3+
push:
4+
pull_request:
5+
permissions:
6+
contents: read
7+
# Optional: allow read access to pull request. Use with `only-new-issues` option.
8+
# pull-requests: read
9+
jobs:
10+
golangci:
11+
name: lint
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/setup-go@v3
15+
with:
16+
go-version: 1.18
17+
- uses: actions/checkout@v3
18+
- name: golangci-lint
19+
uses: golangci/golangci-lint-action@v3
20+
with:
21+
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
22+
version: v1.47.2
23+
24+
# Optional: working directory, useful for monorepos
25+
# working-directory: somedir
26+
27+
# Optional: golangci-lint command line arguments.
28+
# args: --issues-exit-code=0
29+
30+
# Optional: show only new issues if it's a pull request. The default value is `false`.
31+
# only-new-issues: true
32+
33+
# Optional: if set to true then the all caching functionality will be complete disabled,
34+
# takes precedence over all other caching options.
35+
# skip-cache: true
36+
37+
# Optional: if set to true then the action don't cache or restore ~/go/pkg.
38+
# skip-pkg-cache: true
39+
40+
# Optional: if set to true then the action don't cache or restore ~/.cache/go-build.
41+
# skip-build-cache: true
42+
test:
43+
name: go-test
44+
runs-on: ubuntu-latest
45+
steps:
46+
- uses: actions/setup-go@v3
47+
with:
48+
go-version: 1.18
49+
- uses: actions/checkout@v3
50+
- name: test
51+
run: go test -v ./...

.idea/.gitignore

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/kvitto-tcp.iml

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/runConfigurations/Build___Run.xml

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/vcs.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Dockerfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
FROM golang:1.23 AS builder
2+
COPY . /app
3+
RUN cd /app && go mod verify && go build
4+
5+
FROM debian:bullseye
6+
COPY --from=builder /app/kvitto-tcp /usr/bin/kvitto-tcp
7+
8+
CMD ["/usr/bin/kvitto-tcp"]

go.mod

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
module kvitto-tcp
2+
3+
go 1.23.0
4+
5+
toolchain go1.24.0
6+
7+
require github.com/eclipse/paho.mqtt.golang v1.5.0
8+
9+
require (
10+
github.com/gorilla/websocket v1.5.3 // indirect
11+
golang.org/x/net v0.37.0 // indirect
12+
golang.org/x/sync v0.12.0 // indirect
13+
)

0 commit comments

Comments
 (0)