mirror of
https://github.com/on4kjm/FLEcli.git
synced 2025-01-18 13:01:09 +01:00
Create Docker Image to run the application
This commit is contained in:
parent
33dbfde31a
commit
8afb81eed3
10 changed files with 158 additions and 20 deletions
68
.github/workflows/ci.yml
vendored
68
.github/workflows/ci.yml
vendored
|
@ -1,5 +1,6 @@
|
|||
#Continuous integration action
|
||||
name: Go Build & Test
|
||||
# largely inspired by https://brunopaz.dev/blog/building-a-basic-ci-cd-pipeline-for-a-golang-application-using-github-actions
|
||||
name: Build & Test
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
|
@ -7,24 +8,67 @@ on:
|
|||
pull_request:
|
||||
branches:
|
||||
- '*'
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
name: Lint
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: '^1.14.3'
|
||||
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Lint Go Code
|
||||
run: |
|
||||
go get -u golang.org/x/lint/golint
|
||||
golint -set_exit_status ./...
|
||||
|
||||
test:
|
||||
name: Test
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: '^1.14.3'
|
||||
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Run Unit tests.
|
||||
run: |
|
||||
go test -short -coverprofile cover.out -covermode=atomic ./...
|
||||
cat cover.out >> coverage.txt
|
||||
|
||||
- name: Upload Coverage report to CodeCov
|
||||
uses: codecov/codecov-action@v1.0.0
|
||||
with:
|
||||
token: ${{secrets.CODECOV_TOKEN}}
|
||||
file: ./coverage.txt
|
||||
|
||||
|
||||
build:
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest, macOS-latest, windows-latest]
|
||||
runs-on: ${{ matrix.os }}
|
||||
name: Build & Test
|
||||
runs-on: ubuntu-latest
|
||||
name: Build and Integration tests
|
||||
needs: [lint, test]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: '^1.14.0'
|
||||
go-version: '^1.14.3'
|
||||
- run: go mod download
|
||||
- name: Build & Test
|
||||
run: |
|
||||
go build -v .
|
||||
go test ./...
|
||||
- name: Validates GO releaser config
|
||||
uses: goreleaser/goreleaser-action@master
|
||||
with:
|
||||
args: check
|
||||
- name: Run GoReleaser
|
||||
uses: goreleaser/goreleaser-action@master
|
||||
with:
|
||||
args: release --snapshot --skip-publish --rm-dist
|
||||
args: release --snapshot --skip-publish --rm-dist
|
||||
- name: test container
|
||||
run: docker run on4kjm/flecli:latest version -d
|
||||
|
||||
|
|
2
.github/workflows/release.yml
vendored
2
.github/workflows/release.yml
vendored
|
@ -9,6 +9,8 @@ jobs:
|
|||
name: goreleaser
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Login to DockerHub Registry
|
||||
run: echo ${{ secrets.DOCKERHUB_PASSWORD }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
|
||||
- name: Unshallow Fetch
|
||||
run: git fetch --prune --unshallow
|
||||
- uses: actions/setup-go@v2
|
||||
|
|
|
@ -5,6 +5,13 @@ builds:
|
|||
- linux
|
||||
- windows
|
||||
- darwin
|
||||
goarch:
|
||||
- 386
|
||||
- amd64
|
||||
- arm
|
||||
- arm64
|
||||
goarm:
|
||||
- 6
|
||||
ignore:
|
||||
- goos: darwin
|
||||
goarch: 386
|
||||
|
@ -14,6 +21,32 @@ builds:
|
|||
- -s -w -X FLEcli/cmd.version={{.Version}} -X FLEcli/cmd.commit={{.Commit}} -X FLEcli/cmd.date={{.Date}} -X=FLEcli/cmd.builtBy=goReleaser
|
||||
env:
|
||||
- CGO_ENABLED=0
|
||||
|
||||
dockers:
|
||||
- goos: linux
|
||||
goarch: amd64
|
||||
goarm: ''
|
||||
binaries:
|
||||
- FLEcli
|
||||
image_templates:
|
||||
- "on4kjm/flecli:latest"
|
||||
- "on4kjm/flecli:{{ .Tag }}"
|
||||
# Skips the docker push. Could be useful if you also do draft releases.
|
||||
# If set to auto, the release will not be pushed to the docker repository
|
||||
# in case there is an indicator for prerelease in the tag e.g. v1.0.0-rc1
|
||||
# Defaults to false.
|
||||
skip_push: auto
|
||||
# Path to the Dockerfile (from the project root).
|
||||
dockerfile: docker/Dockerfile
|
||||
|
||||
# Template of the docker build flags.
|
||||
build_flag_templates:
|
||||
- "--pull"
|
||||
- "--label=org.opencontainers.image.created={{.Date}}"
|
||||
- "--label=org.opencontainers.image.title={{.ProjectName}}"
|
||||
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
|
||||
- "--label=org.opencontainers.image.version={{.Version}}"
|
||||
|
||||
archives:
|
||||
- replacements:
|
||||
amd64: 64-bit
|
||||
|
@ -26,10 +59,13 @@ archives:
|
|||
format: zip
|
||||
files:
|
||||
- README.md
|
||||
|
||||
checksum:
|
||||
name_template: 'checksums.txt'
|
||||
|
||||
snapshot:
|
||||
name_template: "{{ .Tag }}-next"
|
||||
|
||||
changelog:
|
||||
skip: true
|
||||
sort: asc
|
||||
|
|
26
README.md
26
README.md
|
@ -3,16 +3,30 @@ Multi-platform "Fast Log Entry"(FLE) processing tool.
|
|||
|
||||
![Go Build & Test](https://github.com/jmMeessen/FLEcli/workflows/Go%20Build%20&%20Test/badge.svg)
|
||||
|
||||
["Fast Log Entry"](https://www.df3cb.com/fle/) is a nifty tool, written by DF3CB. It allows quick and efficient entry of radio amateur contacts made during DXpeditions, contests or SOTA/WWFF activation. It can export the listed contacts in ADIF format ready to be uploaded to eQSL/LOTW or submitted for SOTA and WWFF. The program is only availble as a Windows executable which leaves the Mac or Linux users (like me) in the cold.
|
||||
["Fast Log Entry"](https://www.df3cb.com/fle/) is a nifty tool, written by DF3CB. It allows quick and efficient entry of radio amateur contacts made during DXpeditions, contests or SOTA/WWFF activation. It can export the listed contacts in ADIF format ready to be uploaded to eQSL/LOTW or submitted for SOTA and WWFF. The program is only available as a Windows executable which leaves the Mac or Linux users (like me) in the cold.
|
||||
|
||||
This tool is intended to process FLE formated files on other platform than Windows. The FLE file format is described on https://www.df3cb.com/fle/documentation/
|
||||
This tool is intended to process FLE formatted files on other platform than Windows. The FLE file format is described on https://www.df3cb.com/fle/documentation/
|
||||
|
||||
But is also the alibi to learn and explore GO.
|
||||
|
||||
## Usage
|
||||
|
||||
### Installing
|
||||
TBD: Running on a Mac, Linux, windows.
|
||||
The tool is installed by downloading and unpacking the archive for your operating system.
|
||||
|
||||
The releases are downloaded for https://github.com/on4kjm/FLEcli/releases
|
||||
|
||||
The application is available in the following packaging:
|
||||
* `FLEcli_v..._macOS_64-bit.tar.gz` is the MacOS version.
|
||||
* `FLEcli_v..._windows_32-bit.zip` is the Windows version. Only the 32 bit is proposed as it should work also on older Windows version.
|
||||
* `FLEcli_v..._Linux_64-bit.tar.gz` is the 64 bits distribution for Linux.
|
||||
* `FLEcli_v..._Linux_32-bit.tar.gz` is the 32 bits distribution for Linux
|
||||
* `FLEcli_v..._Linux_arm.tar.gz` is the 32 bits ARM (instruction set 6) distribution (for RaspberryPi older models for example)
|
||||
* `FLEcli_v..._Linux_arm64.tar.gz` is the 64 bits ARM (instruction set 6) distribution
|
||||
|
||||
Detailed installation instructions can be found here (TODO).
|
||||
|
||||
**Important note:** at this stage, the MacOS binary is not signed. It will fail to load on the recent OS version unless a very permissive security setting is enable (which is not advised). Therefore, it is advised to run FLEcli as a Docker application (available on DockerHub). An alternative is to compile the application. Further explanation can be found here (TODO)
|
||||
|
||||
### Commands and options
|
||||
|
||||
|
@ -90,7 +104,7 @@ To load and validate the FLE formated file (.txt):
|
|||
./FLEcli load -i=myActivation.txt
|
||||
```
|
||||
This command will parse and display the QSOs in grid format.
|
||||
Fields that couldn't be succesfuly parsed are prefixed with "*".
|
||||
Fields that couldn't be successfully parsed are prefixed with "*".
|
||||
Parsing errors or doubts are listed at the end of the list.
|
||||
|
||||
|
||||
|
@ -103,9 +117,9 @@ To generate an ADIF file based on `activation.txt`:
|
|||
```
|
||||
The `-o` (or the long form, `--output`) specifies the path and name of the output file.
|
||||
If the flag and value are omitted, the tool will generate a filename.
|
||||
It is based on the input filename, just replacing the extention with `.adi`.
|
||||
It is based on the input filename, just replacing the extension with `.adi`.
|
||||
|
||||
The `--overwrite` flag indicates that, if the output file already exsist, it should be overwritten.
|
||||
The `--overwrite` flag indicates that, if the output file already exists, it should be overwritten.
|
||||
|
||||
The `--interpolate` flag will interpolate the missing non-entered times based on the first and the last entered time.
|
||||
|
||||
|
|
4
docker-FLEcli.sh
Executable file
4
docker-FLEcli.sh
Executable file
|
@ -0,0 +1,4 @@
|
|||
#!/bin/bash
|
||||
|
||||
CURRENT_UID = $(id -u):$(id -g)
|
||||
docker run --rm -ti --user $(CURRENT_UID) -v $(pwd):/FLEcli_data jmmeessen/flecli "$@"
|
1
docker/.dockerignore
Normal file
1
docker/.dockerignore
Normal file
|
@ -0,0 +1 @@
|
|||
*.md
|
16
docker/Dockerfile
Normal file
16
docker/Dockerfile
Normal file
|
@ -0,0 +1,16 @@
|
|||
FROM alpine:3.12 AS builder
|
||||
|
||||
# Copy the executable
|
||||
COPY FLEcli /FLEcli_bin/FLEcli
|
||||
RUN chmod +x /FLEcli_bin/FLEcli
|
||||
|
||||
|
||||
FROM scratch
|
||||
|
||||
COPY --from=builder /FLEcli_bin/FLEcli /FLEcli_bin/FLEcli
|
||||
|
||||
# Create the data directory and set it as the defautl directory
|
||||
WORKDIR /FLEcli_data
|
||||
|
||||
ENTRYPOINT ["/FLEcli_bin/FLEcli"]
|
||||
CMD ["help"]
|
21
docker/README.md
Normal file
21
docker/README.md
Normal file
|
@ -0,0 +1,21 @@
|
|||
## Building docker image by hand
|
||||
|
||||
* `docker build -t fle_cli .`
|
||||
|
||||
## goReleaser built Docker images
|
||||
|
||||
* `goreleaser --snapshot --skip-publish --rm-dist`
|
||||
* docker image is named "jmmeessen/flecli". It creates two labels automatically ("latest" and the last release)
|
||||
|
||||
## Running the container
|
||||
|
||||
* `docker run --rm -i fle_cli version -d`
|
||||
* `docker run --rm -i -v "$(pwd)":/FLEcli_data fle_cli version -d`
|
||||
* `docker run --rm -i jmmeessen/flecli version -d`
|
||||
|
||||
* `docker run --rm -i --user $(id -u):$(id -g) -v $(pwd):/FLEcli_data jmmeessen/flecli`.
|
||||
* `alias FLEcli="docker run --rm --user $(id -u):$(id -g) -v $(pwd):/FLEcli_data jmmeessen/flecli"`
|
||||
|
||||
## Running bash in the container
|
||||
|
||||
* `docker run --rm -i -v "$(pwd)":/FLEcli_data --entrypoint /bin/sh fle_cli`
|
1
go.mod
1
go.mod
|
@ -15,5 +15,4 @@ require (
|
|||
github.com/spf13/viper v1.7.0
|
||||
golang.org/x/sys v0.0.0-20200523222454-059865788121 // indirect
|
||||
gopkg.in/ini.v1 v1.57.0 // indirect
|
||||
go.hein.dev/go-version v0.1.0
|
||||
)
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
## to build with goreleaser
|
||||
|
||||
* `goreleaser --snapshot --skip-publish --rm-dist`
|
||||
* `dist/FLEcli_darwin_amd64/FLEcli`
|
||||
* `dist/FLEcli_darwin_amd64/FLEcli`
|
||||
* `docker build -f docker/Dockerfile -t test/test dist/FLEcli_linux_arm64`
|
Loading…
Reference in a new issue