Skip to content

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
thbkrkr committed Sep 20, 2023
1 parent 4ba163b commit 691891e
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 13 deletions.
8 changes: 3 additions & 5 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,11 @@ steps:

- label: "publish-image"
commands:
# TODO: setup vault access
#- .buildkite/registry-login.sh
#- make build-push-image
#- make build-image
#- drivah build --push .
- drivah build .
agents:
image: "docker.elastic.co/ci-agent-images/drivah:0.24.2"
image: "docker.elastic.co/ci-agent-images/drivah:0.24.3"
cpu: "4"
memory: "4G"
ephemeralStorage: "20G"
ephemeralStorage: "20G"
4 changes: 4 additions & 0 deletions .buildkite/registry-login.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#!/bin/bash

# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
# or more contributor license agreements. Licensed under the Elastic License 2.0;
# you may not use this file except in compliance with the Elastic License 2.0.

set -eu

username=$(vault read -field=username "$DOCKER_REGISTRY_VAULT_PATH")
Expand Down
1 change: 0 additions & 1 deletion .dockerignore

This file was deleted.

29 changes: 24 additions & 5 deletions build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,36 @@ ARG SHA1
ARG SNAPSHOT

WORKDIR /go/src/github.com/elastic/eck-diagnostics
COPY . ./

RUN ls
RUN make build-binary
COPY go.mod go.mod
COPY go.sum go.sum

RUN --mount=type=ssh go mod download

COPY build build
COPY cmd cmd
COPY internal internal
COPY Makefile Makefile

RUN make build-binary generate-notice.txt

#
# package binaries in a lighter final image
#
FROM alpine:3.18

COPY --from=builder /go/src/github.com/elastic/eck-diagnostics/NOTICE.txt /NOTICE.txt
ARG IMAGE_TAG
ENV IMAGE_TAG=$IMAGE_TAG

RUN apk add --no-cache bash curl

COPY build/bin /usr/local/bin

COPY --from=builder /go/src/github.com/elastic/eck-diagnostics/artefacts /artefacts
COPY --from=builder /go/src/github.com/elastic/eck-diagnostics/NOTICE.txt /NOTICE.txt

RUN addgroup -S 65536 && adduser -S 65536 -G 65536
USER 65536:65536
WORKDIR /tmp

ENTRYPOINT ["ls", "-1", "/artefacts"]
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
7 changes: 5 additions & 2 deletions build/drivah.toml.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,22 @@ VERSION="${VERSION:-$(cat "$ROOT/VERSION")}"
tag() {
tag="$VERSION-SNAPSHOT"
if [[ "${BUILDKITE_TAG:-}" != "" ]]; then
SNAPSHOT=""
SNAPSHOT="false"
tag="$VERSION"
fi
echo "$tag"
}

IMAGE_TAG="$(tag)"

cat <<EOF
[container.image]
names = ["docker.elastic.co/eck/eck-diagnostics"]
tags = ["latest", "$SHA1", "$(tag)"]
tags = ["latest", "${SHA1}", "${IMAGE_TAG}"]
build_context = ".."
[container.image.build_args]
IMAGE_TAG = "${IMAGE_TAG}"
VERSION = "${VERSION}"
SHA1 = "${SHA1}"
SNAPSHOT = "${SNAPSHOT}"
Expand Down

0 comments on commit 691891e

Please sign in to comment.