Skip to content

Commit

Permalink
Add Docerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
outdead committed Mar 14, 2021
1 parent 2f41a8a commit f994999
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 8 deletions.
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.

## [Unreleased]

## [v0.9.1] - 2021-03-14
### Added
- Added Dockerfile.

### Changed
- Disabled CGO in release script.

## [v0.9.0] - 2020-12-20
### Added
- Added config validation.
Expand Down Expand Up @@ -86,7 +93,8 @@ than entry in configuration file.
### Added
- Initial implementation.

[Unreleased]: https://github.com/gorcon/rcon-cli/compare/v0.9.0...HEAD
[Unreleased]: https://github.com/gorcon/rcon-cli/compare/v0.9.1...HEAD
[v0.9.1]: https://github.com/gorcon/rcon-cli/compare/v0.9.0...v0.9.1
[v0.9.0]: https://github.com/gorcon/rcon-cli/compare/v0.8.1...v0.9.0
[v0.8.1]: https://github.com/gorcon/rcon-cli/compare/v0.8.0-beta.2...v0.8.1
[v0.8.0-beta.2]: https://github.com/gorcon/rcon-cli/compare/v0.8.0-beta...v0.8.0-beta.2
Expand Down
10 changes: 10 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM scratch
MAINTAINER Pavel Korotkiy <[email protected]>

COPY LICENSE /
COPY README.md /
COPY CHANGELOG.md /
COPY rcon.yaml /
COPY rcon-cli /rcon

CMD ["/rcon"]
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2020 Pavel Korotkiy (outdead)
Copyright (c) 2021 Pavel Korotkiy (outdead)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
[![top level coverage](https://gocover.io/_badge/github.com/gorcon/rcon-cli?0)](https://gocover.io/github.com/gorcon/rcon-cli)
[![Go Report Card](https://goreportcard.com/badge/github.com/gorcon/rcon-cli)](https://goreportcard.com/report/github.com/gorcon/rcon-cli)
[![GitHub All Releases](https://img.shields.io/github/downloads/gorcon/rcon-cli/total)](https://github.com/gorcon/rcon-cli/releases)
[![Docker Pulls](https://img.shields.io/docker/pulls/outdead/rcon.svg)](https://hub.docker.com/r/outdead/rcon)

CLI for executing queries on a remote [Source dedicated game server](https://developer.valvesoftware.com/wiki/Source_Dedicated_Server), using the [RCON](https://developer.valvesoftware.com/wiki/Source_RCON_Protocol) protocol.

Expand All @@ -22,6 +23,10 @@ Download the binary for your platform from the [latest releases](https://github.

See [Changelog](CHANGELOG.md) for release details

### Docker

docker pull outdead/rcon

## Usage

```text
Expand Down
10 changes: 6 additions & 4 deletions internal/logger/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,14 @@ func OpenFile(name string) (file *os.File, err error) {
switch _, err = os.Stat(name); {
case err == nil:
file, err = os.OpenFile(name, os.O_APPEND|os.O_WRONLY, 0666)
if err != nil {
return file, fmt.Errorf("open: %w", err)
}
case os.IsNotExist(err):
file, err = os.Create(name)
}

if err != nil {
return file, fmt.Errorf("open: %w", err)
if err != nil {
return file, fmt.Errorf("create: %w", err)
}
}

return file, nil
Expand Down
5 changes: 3 additions & 2 deletions release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ function make_release() {
local dir="release/${release_name}"

mkdir -p "${dir}"
env GOARCH="${arch}" GOOS="${os}" go build -ldflags "-s -w -X main.Version=${VERSION}" -o "${dir}/rcon${ext}"
#upx-ucl --best "${dir}/rcon${ext}" -o "${dir}/rcon-upx${ext}"
env GOARCH="${arch}" GOOS="${os}" CGO_ENABLED=0 go build -ldflags "-s -w -X main.Version=${VERSION}" -o "${dir}/rcon${ext}"

cp LICENSE "${dir}"
cp README.md "${dir}"
Expand All @@ -52,3 +51,5 @@ make_release amd64 linux "rcon-${VERSION}-amd64_linux"
make_release 386 windows "rcon-${VERSION}-win32" .exe
make_release amd64 windows "rcon-${VERSION}-win64" .exe
make_release amd64 darwin "rcon-${VERSION}-amd64_darwin"

env GOARCH="amd64" GOOS="linux" CGO_ENABLED=0 go build -ldflags "-s -w -X main.Version=${VERSION}"

0 comments on commit f994999

Please sign in to comment.