feat: Build process for 2 binaries (api,cli)

pull/15/head v0.3.0
Karan Sharma 2021-03-02 18:58:49 +05:30
parent 083ba19363
commit 7d0499c432
3 changed files with 68 additions and 20 deletions

View File

@ -4,6 +4,7 @@ env:
builds: builds:
- binary: doggo - binary: doggo
id: cli
goos: goos:
- windows - windows
- darwin - darwin
@ -16,7 +17,23 @@ builds:
- 7 - 7
ldflags: ldflags:
- -s -w -X "main.buildVersion={{ .Tag }} ({{ .ShortCommit }} {{ .Date }})" - -s -w -X "main.buildVersion={{ .Tag }} ({{ .ShortCommit }} {{ .Date }})"
dir: ./cmd/doggo/ dir: ./cmd/doggo/cli/
- binary: doggo-api.bin
id: api
goos:
- windows
- darwin
- linux
goarch:
- amd64
- arm64
goarm:
- 6
- 7
ldflags:
- -s -w -X "main.buildVersion={{ .Tag }} ({{ .ShortCommit }} {{ .Date }})"
dir: ./cmd/doggo/api/
archives: archives:
- format: tar.gz - format: tar.gz
@ -35,21 +52,45 @@ snapcrafts:
dockers: dockers:
- image_templates: - image_templates:
- "ghcr.io/mr-karan/doggo:{{ .Tag }}" - "ghcr.io/mr-karan/doggo-cli:{{ .Tag }}"
- "ghcr.io/mr-karan/doggo:latest" - "ghcr.io/mr-karan/doggo-cli:latest"
binaries: binaries:
- doggo - doggo
dockerfile: Dockerfile dockerfile: Dockerfile-cli
build_flag_templates: build_flag_templates:
- "--build-arg" - "--build-arg"
- "ARCH=amd64" - "ARCH=amd64"
- image_templates: - image_templates:
- "ghcr.io/mr-karan/doggo:{{ .Tag }}-arm64v8" - "ghcr.io/mr-karan/doggo-cli:{{ .Tag }}-arm64v8"
- "ghcr.io/mr-karan/doggo:latest-arm64v8" - "ghcr.io/mr-karan/doggo-cli:latest-arm64v8"
binaries: binaries:
- doggo - doggo
goarch: arm64 goarch: arm64
dockerfile: Dockerfile dockerfile: Dockerfile-cli
build_flag_templates: build_flag_templates:
- "--build-arg" - "--build-arg"
- "ARCH=arm64v8" - "ARCH=arm64v8"
- image_templates:
- "ghcr.io/mr-karan/doggo-api:{{ .Tag }}"
- "ghcr.io/mr-karan/doggo-api:latest"
binaries:
- doggo-api.bin
dockerfile: Dockerfile-api
build_flag_templates:
- "--build-arg"
- "ARCH=amd64"
extra_files:
- config-api-sample.toml
- image_templates:
- "ghcr.io/mr-karan/doggo-api:{{ .Tag }}-arm64v8"
- "ghcr.io/mr-karan/doggo-api:latest-arm64v8"
binaries:
- doggo-api.bin
goarch: arm64
dockerfile: Dockerfile-api
build_flag_templates:
- "--build-arg"
- "ARCH=arm64v8"
extra_files:
- config-api-sample.toml

7
Dockerfile-api 100644
View File

@ -0,0 +1,7 @@
# Dockerfile
ARG ARCH
FROM ${ARCH}/alpine
WORKDIR /app
COPY doggo-api.bin .
COPY config-api-sample.toml config.toml
CMD ["./doggo-api.bin"]