Skip to content

Commit

Permalink
feat: add Docker image (#740)
Browse files Browse the repository at this point in the history
* feat: add Docker distribution

* fix: change output directory name

* feat: add image labels

* chore: debug ci

* fix: ci syntax

* fix: enable release ci

* chore: ci job wording

* fix: dockerfile name

* feat: add symlink for instrument.js
  • Loading branch information
seemk authored Jun 27, 2023
1 parent 255959b commit fa9eb51
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 0 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/publish-docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Publish splunk-otel-js Docker image to ghcr.io

on:
release:
types: [published]

jobs:
publish-image:
runs-on: ubuntu-20.04
permissions:
packages: write
contents: read
steps:
- uses: actions/[email protected]

- uses: docker/setup-buildx-action@v2

- name: Put GITHUB_REF_NAME into env
run: echo GITHUB_REF_NAME=${GITHUB_REF_NAME} >> $GITHUB_ENV

- name: Set the major version number
run: echo MAJOR_VERSION=${GITHUB_REF_NAME} | sed -e 's/\..*//' >> $GITHUB_ENV

- name: Login to GitHub Container Registry
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: build and publish container
uses: docker/[email protected]
with:
push: true
file: Dockerfile
build-args: |
RELEASE_VER=${{ env.GITHUB_REF_NAME }}
tags: |
ghcr.io/signalfx/splunk-otel-js/splunk-otel-js:latest
ghcr.io/signalfx/splunk-otel-js/splunk-otel-js:${{ env.MAJOR_VERSION }}
ghcr.io/signalfx/splunk-otel-js/splunk-otel-js:${{ env.GITHUB_REF_NAME }}
18 changes: 18 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM node:16 AS build

WORKDIR /splunk-otel-js
COPY . .
RUN npm install
RUN npm run compile
RUN npm run prebuild:os '14.0.0' '15.0.0' '16.0.0' '17.0.1' '18.0.0'
RUN npm pack && tar xf splunk-otel-$(npm view @splunk/otel version).tgz
RUN npm prune --omit=dev && cp -r node_modules/ package

FROM busybox

LABEL org.opencontainers.image.source="https://github.com/signalfx/splunk-otel-js"
LABEL org.opencontainers.image.description="Splunk Distribution of OpenTelemetry Node.js Instrumentation"

COPY --from=build /splunk-otel-js/package /autoinstrumentation
RUN chmod -R go+r /autoinstrumentation
RUN cd /autoinstrumentation && ln -s ./instrument.js /autoinstrumentation/autoinstrumentation.js

0 comments on commit fa9eb51

Please sign in to comment.