Skip to content

Commit

Permalink
new: k6-influx docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
Altair-Bueno committed Oct 24, 2023
0 parents commit b1199d7
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 0 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/builder.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
on:
workflow_call:
inputs:
context:
required: true
type: string
dockerfile:
required: true
type: string
name:
required: true
type: string
platforms:
required: false
type: string
default: "linux/amd64,linux/arm64"

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ inputs.name }}
jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- # Add support for more platforms with QEMU (optional)
# https://github.com/docker/setup-qemu-action
name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: ${{ inputs.context }}
file: ${{ inputs.dockerfile }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: ${{ inputs.platforms }}
18 changes: 18 additions & 0 deletions .github/workflows/k6-influx.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
on:
push:
paths:
- k6-influx/**/*
branches:
- "master"
- "main"
- "latest"
release:
types:
- created
jobs:
build-tensorflow:
uses: ./.github/workflows/build.yml
with:
context: k6-influx
dockerfile: k6-influx/Dockerfile
name: k6-influx
17 changes: 17 additions & 0 deletions k6-influx/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# From https://github.com/grafana/xk6-output-influxdb/blob/5411750fc094bf48198b6b1e15a528732a1d1e20/Dockerfile
# Licensed under Apache 2.0 License. See https://github.com/grafana/xk6-output-influxdb/blob/5411750fc094bf48198b6b1e15a528732a1d1e20/LICENSE

FROM golang:1.20-alpine3.17 as builder
WORKDIR $GOPATH/src/go.k6.io/k6
RUN apk --no-cache add git
RUN go install go.k6.io/xk6/cmd/[email protected]
RUN xk6 build --with github.com/grafana/[email protected] --output /tmp/k6

FROM alpine:3.17
RUN apk add --no-cache ca-certificates && \
adduser -D -u 12345 -g 12345 k6
COPY --from=builder /tmp/k6 /usr/bin/k6

USER 12345
WORKDIR /home/k6
ENTRYPOINT ["k6"]

0 comments on commit b1199d7

Please sign in to comment.