Skip to content

Commit

Permalink
Add docker config to goreleaser
Browse files Browse the repository at this point in the history
  • Loading branch information
Konstantinos Bairaktaris committed Oct 6, 2022
1 parent 3cc6468 commit c032ec8
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ jobs:
uses: actions/setup-go@v2
with:
go-version: 1.16
- name: Docker Login
uses: docker/login-action@v1
with:
username: transifex
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ cli
.vscode
.DS_Store
local_example/
.envrc
65 changes: 65 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---

builds:
- main: ./main.go
env:
Expand All @@ -14,18 +16,81 @@ builds:
goarch: arm64
- goos: darwin
goarch: 386

archives:
- format_overrides:
- goos: windows
format: zip
name_template: "tx-{{ .Os }}-{{ .Arch }}"

checksum:
name_template: 'checksums.txt'

snapshot:
name_template: "{{ .Tag }}-next"

changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'

dockers:
- goarch: amd64
goos: linux
image_templates:
- "transifex/txcli:latest-amd64"
- "transifex/txcli:v{{ .Major }}-amd64"
- "transifex/txcli:v{{ .Major }}.{{ .Minor }}-amd64"
- "transifex/txcli:v{{ .Major }}.{{ .Minor }}.{{ .Patch }}-amd64"
build_flag_templates:
- "--platform=linux/amd64"
dockerfile: 'build/Dockerfile-goreleaser'

- goarch: '386'
goos: linux
image_templates:
- "transifex/txcli:latest-386"
- "transifex/txcli:v{{ .Major }}-386"
- "transifex/txcli:v{{ .Major }}.{{ .Minor }}-386"
- "transifex/txcli:v{{ .Major }}.{{ .Minor }}.{{ .Patch }}-amd64"
build_flag_templates:
- "--platform=linux/386"
dockerfile: 'build/Dockerfile-goreleaser'

- goarch: arm64
goos: linux
image_templates:
- "transifex/txcli:latest-arm64"
- "transifex/txcli:v{{ .Major }}-arm64"
- "transifex/txcli:v{{ .Major }}.{{ .Minor }}-arm64"
- "transifex/txcli:v{{ .Major }}.{{ .Minor }}.{{ .Patch }}-amd64"
build_flag_templates:
- "--platform=linux/arm64/v8"
dockerfile: 'build/Dockerfile-goreleaser'

docker_manifests:
- name_template: "transifex/txcli:latest"
image_templates:
- "transifex/txcli:latest-386"
- "transifex/txcli:latest-amd64"
- "transifex/txcli:latest-arm64"

- name_template: "transifex/txcli:v{{ .Major }}"
image_templates:
- "transifex/txcli:v{{ .Major }}-386"
- "transifex/txcli:v{{ .Major }}-amd64"
- "transifex/txcli:v{{ .Major }}-arm64"

- name_template: "transifex/txcli:v{{ .Major }}.{{ .Minor }}"
image_templates:
- "transifex/txcli:v{{ .Major }}.{{ .Minor }}-386"
- "transifex/txcli:v{{ .Major }}.{{ .Minor }}-amd64"
- "transifex/txcli:v{{ .Major }}.{{ .Minor }}-arm64"

- name_template: "transifex/txcli:v{{ .Major }}.{{ .Minor }}.{{ .Patch }}"
image_templates:
- "transifex/txcli:v{{ .Major }}.{{ .Minor }}.{{ .Patch }}-386"
- "transifex/txcli:v{{ .Major }}.{{ .Minor }}.{{ .Patch }}-amd64"
- "transifex/txcli:v{{ .Major }}.{{ .Minor }}.{{ .Patch }}-arm64"
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ This script will:
**Note:** You need to restart your terminal for the `PATH` changes to be applied.

### Download from Github Releases (Linux/Mac/Windows)

Another way to install the Transifex CLI is to download
the latest version of the binary from GitHub
[here](https://github.com/transifex/cli/releases).
Expand All @@ -33,6 +34,7 @@ Clone the [repository](https://github.com/transifex/cli) and go into the directo
cd /path/to/transifex/cli
```
### Building from source

The default way to build the binary is

```shell
Expand All @@ -50,6 +52,18 @@ the following command:

This will build the binary and it will copy it at `./bin/` in the repository.

### Running from Docker (beta)

You can skip the installation and run the Transifex client from Docker if it is
available in your system. All you have to do is put this line:

```sh
alias tx='touch ~/.transifexrc; docker run --rm -i -t -v `pwd`:/app -v ~/.transifexrc:/.transifexrc -v /etc/ssl/certs/ca-certificates.crt:/etc/ssl/certs/ca-certificates.crt transifex/txcli --root-config /.transifexrc'
```

to your `~/.bashrc` / `~/.zshrc`. (The first time you use it you will have to
wait for a ~5MB download)

## Migrating from older versions of the client

The current version of the client maintains backwards compatibility for the `tx push`
Expand Down
4 changes: 4 additions & 0 deletions build/Dockerfile-goreleaser
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM scratch
COPY tx /
WORKDIR /app
ENTRYPOINT ["/tx"]

0 comments on commit c032ec8

Please sign in to comment.