Skip to content

Commit

Permalink
ci: added release-docker task
Browse files Browse the repository at this point in the history
  • Loading branch information
sandipndev committed May 15, 2024
1 parent 7708533 commit 4ba3d37
Show file tree
Hide file tree
Showing 3 changed files with 92 additions and 0 deletions.
21 changes: 21 additions & 0 deletions Dockerfile.release
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM alpine:latest as load

ARG VERSION
ENV VERSION ${VERSION}
RUN mkdir cala-home && mkdir cala && cd cala \
&& wget https://github.com/GaloyMoney/cala/releases/download/${VERSION}/cala-x86_64-unknown-linux-musl-${VERSION}.tar.gz -O cala.tar.gz \
&& tar --strip-components=1 -xf cala.tar.gz \
&& mv cala-server /usr/local/bin && cd ../ && rm -rf ./cala

FROM gcr.io/distroless/static
COPY --from=load /usr/local/bin/cala-server /bin/cala-server
COPY --from=load --chown=1000:0 --chmod=755 /cala-home /cala
USER 1000
ARG VERSION
ARG BUILDTIME
ARG COMMITHASH
ENV VERSION ${VERSION}
ENV BUILDTIME ${BUILDTIME}
ENV COMMITHASH ${COMMITHASH}
ENV CALA_HOME /cala
CMD ["cala-server"]
63 changes: 63 additions & 0 deletions ci/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ groups:
- bats-tests
- build-edge-image
- release
- release-docker

jobs:
- #@ rust_check_code()
Expand Down Expand Up @@ -198,13 +199,75 @@ jobs:
params:
file: version/version

- name: release-docker
serial: true
plan:
- in_parallel:
- get: repo
passed:
- release
- get: version
passed:
- release
trigger: true
- get: pipeline-tasks
- task: prepare-docker-build
config:
platform: linux
image_resource: #@ rust_task_image_config()
inputs:
- name: pipeline-tasks
- name: version
- name: repo
outputs:
- name: repo
run:
path: pipeline-tasks/ci/tasks/prep-docker-build-env.sh
- task: build
config:
platform: linux
image_resource:
type: registry-image
source:
repository: gcr.io/kaniko-project/executor
tag: debug
inputs:
- name: repo
outputs:
- name: image
run:
path: /bin/sh
args:
- -exc
- |
/kaniko/executor \
--dockerfile=repo/Dockerfile.release \
--context=repo \
$(awk -F= '{print "--build-arg="$1"="$2}' repo/.env) \
--use-new-run \
--single-snapshot \
--cache=false \
--no-push \
--tar-path=image/image.tar
- put: latest-image
params:
image: image/image.tar
additional_tags: version/version

resources:
- #@ repo_resource(True)
- #@ pipeline_tasks_resource()
- #@ slack_resource()
- #@ edge_image_resource()
- #@ version_resource()
- #@ gh_release_resource()
- name: latest-image
type: registry-image
source:
tag: latest
username: #@ data.values.docker_registry_user
password: #@ data.values.docker_registry_password
repository: #@ public_docker_registry() + "/" + data.values.gh_repository
- name: nix-host
type: pool
source:
Expand Down
8 changes: 8 additions & 0 deletions ci/tasks/prepare-docker-build-env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

if [[ -f version/version ]]; then
echo "VERSION=$(cat version/version)" >> repo/.env
fi

echo "COMMITHASH=$(cat repo/.git/ref)" >> repo/.env
echo "BUILDTIME=$(date -u '+%F-%T')" >> repo/.env

0 comments on commit 4ba3d37

Please sign in to comment.