Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions Dockerfile

This file was deleted.

48 changes: 43 additions & 5 deletions Taskfile.dist.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ version: "3"

silent: true

env:
CGO_ENABLED: "0"
GO111MODULE: "on"

vars:
version: '{{.version | default "dev"}}'

Expand Down Expand Up @@ -190,7 +194,6 @@ tasks:
env:
GOOS: "{{.targetOS}}"
GOARCH: "{{.targetArch}}"
CGO_ENABLED: 0

build:
desc: "Build trx dev binary."
Expand All @@ -203,16 +206,51 @@ tasks:

_image:build:
cmds:
- docker build {{.CLI_ARGS}} --platform=linux/amd64 -f "{{.dfilePath}}" -t "{{.imageName}}" "{{.context | default "."}}"
- docker build {{.CLI_ARGS}} -f "{{.dfilePath}}" -t "{{.imageName}}" "{{.context | default "."}}"

image:build:builder:
desc: 'Build werf builder image. Important vars: "imageName".'
desc: 'Build main builder image. Important vars: "imageName".'
cmds:
- task: _image:build
vars:
dfilePath: Dockerfile
dfilePath: scripts/builder/Dockerfile
imageName:
sh: "echo ghcr.io/flant/trx/builder:$(git rev-parse HEAD)"

_image:push:
cmds:
- docker push {{.CLI_ARGS}} "{{.imageName}}"

image:publish:builder:
desc: 'Build and publish main builder image. Important vars: "imageName".'
deps:
- image:build:builder
cmds:
- task: _image:push
vars:
imageName:
sh: "echo registry-write.werf.io/trx/builder:$(git rev-parse HEAD)"
sh: "echo ghcr.io/flant/trx/builder:$(git rev-parse HEAD)"

clean:
desc: "Clean all temporary files and build artifacts."
deps:
- clean:binaries

clean:binaries:
desc: "Clean all built binaries."
deps:
- clean:binaries:dev
- clean:binaries:dist

clean:binaries:dev:
desc: "Clean built dev binaries."
cmds:
- rm -rf ./bin

clean:binaries:dist:
desc: "Clean built release binaries."
cmds:
- rm -rf ./dist

verify:dist:binaries:
desc: "Verify that the distributable binaries are built and have correct platform/arch."
Expand Down
20 changes: 20 additions & 0 deletions scripts/builder/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM --platform=linux/amd64 golang:1.23-bookworm@sha256:3149bc5043fa58cf127fd8db1fdd4e533b6aed5a40d663d4f4ae43d20386665f
ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get -y update && \
apt-get -y install apt-utils gcc-aarch64-linux-gnu file && \
curl -sSLO https://github.com/go-task/task/releases/download/v3.33.1/task_linux_amd64.deb && \
apt-get -y install ./task_linux_amd64.deb && \
rm -rf ./task_linux_amd64.deb /var/cache/apt/* /var/lib/apt/lists/* /var/log/*

ADD cmd /.trx-deps/cmd
ADD internal /.trx-deps/internal
ADD go.mod go.sum Taskfile.dist.yaml /.trx-deps/
ADD scripts /.trx-deps/scripts

RUN cd /.trx-deps && \
task build:dist version=base && \
task verify:dist:binaries version=base && \
rm -rf /.trx-deps

RUN git config --global --add safe.directory /git
2 changes: 1 addition & 1 deletion trdl.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
docker_image: registry-write.werf.io/trx/builder:29fec0a40d0236b70d9f974a4ffa9feab063525c@sha256:a197644941c7597b6ceddcc7037db52bf8db8a65a9c2207063b5e07815670d66
dockerImage: ghcr.io/flant/trx/builder:53607301c1d0b7f6c75e52a5784382abb53ac8ce@sha256:95071741e79de3c075fb2fd7c3fdddc54150f53d3f8fe7867d26ffb39c2e05c0
commands:
- task build:dist version={{ .Tag }}
- task verify:dist:binaries version={{ .Tag }}
Expand Down