Skip to content

Commit f18e759

Browse files
Feature/docker (#20)
Add GitHub workflow for building the Docker image --------- Signed-off-by: Shay Keren <[email protected]> Co-authored-by: Shay Keren <[email protected]>
1 parent 7f84029 commit f18e759

File tree

14 files changed

+130
-60
lines changed

14 files changed

+130
-60
lines changed

.dockerignore

Lines changed: 0 additions & 16 deletions
This file was deleted.
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
name: Publish Digma release
2+
3+
# Controls when the workflow will run
4+
on:
5+
workflow_dispatch:
6+
release:
7+
types: [released]
8+
9+
# permissions are needed if pushing to ghcr.io
10+
permissions:
11+
packages: write
12+
13+
jobs:
14+
build:
15+
name: Build Jaeger UI
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- uses: actions/checkout@v3
20+
- uses: actions/setup-node@v3
21+
with:
22+
cache: yarn
23+
node-version: '16'
24+
- run: yarn install --frozen-lockfile
25+
- run: yarn lint
26+
- run: yarn build
27+
28+
- uses: actions/upload-artifact@v3
29+
with:
30+
name: jaeger-build
31+
path: packages/jaeger-ui/build/
32+
33+
- uses: actions/upload-artifact@v3
34+
with:
35+
name: nginx-config
36+
path: nginx.conf.template
37+
38+
- uses: actions/upload-artifact@v3
39+
with:
40+
name: dockerfile
41+
path: Dockerfile
42+
43+
download:
44+
name: Build and push Docker image
45+
needs: [build]
46+
runs-on: ubuntu-latest
47+
48+
steps:
49+
- uses: actions/download-artifact@v3
50+
with:
51+
name: jaeger-build
52+
path: build
53+
54+
- uses: actions/download-artifact@v3
55+
with:
56+
name: nginx-config
57+
58+
- uses: actions/download-artifact@v3
59+
with:
60+
name: dockerfile
61+
62+
# https://github.com/docker/setup-qemu-action
63+
- name: Set up QEMU
64+
uses: docker/setup-qemu-action@v2
65+
66+
# https://github.com/docker/setup-buildx-action
67+
- name: Set up Docker Buildx
68+
id: buildx
69+
uses: docker/setup-buildx-action@v2
70+
71+
- name: Login to Docker Hub
72+
uses: docker/login-action@v2
73+
with:
74+
username: ${{ secrets.DOCKERHUB_DIGMAAI_USERNAME }}
75+
password: ${{ secrets.DOCKERHUB_DIGMAAI_TOKEN }}
76+
77+
- name: Docker meta
78+
id: metadata # you'll use this in the next step
79+
uses: docker/metadata-action@v4
80+
with:
81+
# list of Docker images to use as base name for tags
82+
images: digmaai/jaeger-ui
83+
# Docker tags based on the following events/attributes
84+
tags: |
85+
type=schedule
86+
type=ref,event=branch
87+
type=ref,event=pr
88+
type=semver,pattern={{version}}
89+
type=semver,pattern={{major}}.{{minor}}
90+
type=semver,pattern={{major}}
91+
type=sha
92+
# set latest tag for digma branch
93+
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'digma') }}
94+
95+
- name: Build and push
96+
uses: docker/build-push-action@v4
97+
with:
98+
context: .
99+
file: ./Dockerfile
100+
platforms: linux/amd64,linux/arm64
101+
push: ${{ github.event_name != 'pull_request' }}
102+
tags: ${{ steps.metadata.outputs.tags }}
103+
labels: ${{ steps.metadata.outputs.labels }}

Dockerfile

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,6 @@
1-
FROM node:16.20.0 AS build
2-
3-
WORKDIR /app
4-
5-
COPY package.json ./
6-
COPY yarn.lock ./
7-
COPY packages/jaeger-ui/package.json ./packages/jaeger-ui/
8-
COPY . .
9-
RUN yarn install --frozen-lockfile
10-
# RUN yarn prettier-lint
11-
# RUN yarn eslint
12-
13-
WORKDIR /app/packages/jaeger-ui
14-
15-
# RUN yarn test
16-
RUN yarn build
17-
181
FROM nginx:1.25.0
192

20-
COPY --from=build /app/packages/jaeger-ui/build/ /usr/share/nginx/html/
3+
COPY ./build/ /usr/share/nginx/html/
214
COPY ./nginx.conf.template /etc/nginx/conf.d/default.conf.template
225

236
CMD ["/bin/sh" , "-c" , "envsubst '${JAEGER_QUERY_URL}' < /etc/nginx/conf.d/default.conf.template > /etc/nginx/conf.d/default.conf && exec nginx -g 'daemon off;'"]

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
"coverage": "lerna run coverage",
4444
"eslint": "eslint --cache 'scripts/*.{js,jsx,ts,tsx}' 'packages/*/src/**/*.{js,jsx,ts,tsx}' 'packages/*/*.{js,jsx,ts,tsx}'",
4545
"fmt": "yarn prettier",
46-
"lint": "npm-run-all -ln --parallel prettier-lint tsc-lint eslint check-license",
46+
"lint": "npm-run-all -ln --parallel prettier-lint tsc-lint eslint",
4747
"prepare": "lerna run --stream --sort prepublishOnly",
4848
"prettier": "prettier --write '{.,scripts}/*.{js,jsx,json,md,ts,tsx}' 'packages/*/{src,demo/src}/**/!(layout.worker.bundled|react-vis).{css,js,jsx,json,md,ts,tsx}' 'packages/*/*.{css,js,jsx,json,md,ts,tsx}'",
4949
"prettier-lint": "prettier --list-different '{.,scripts}/*.{js,jsx,json,md,ts,tsx}' 'packages/*/{src,demo/src}/**/!(layout.worker.bundled|react-vis).{css,js,jsx,json,md,ts,tsx}' 'packages/*/*.{css,js,jsx,json,md,ts,tsx}'",

packages/jaeger-ui/src/api/jaeger.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,9 @@ function getJSON(url, options = {}) {
7777
});
7878
}
7979

80-
export const DEFAULT_API_ROOT = isString(window.apiBaseUrl) ? `${window.apiBaseUrl}/api/` : prefixUrl('/api/');
80+
export const DEFAULT_API_ROOT = isString(window.apiBaseUrl)
81+
? `${window.apiBaseUrl}/api/`
82+
: prefixUrl('/api/');
8183
export const ANALYTICS_ROOT = prefixUrl('/analytics/');
8284
export const DEFAULT_DEPENDENCY_LOOKBACK = moment.duration(1, 'weeks').asMilliseconds();
8385

packages/jaeger-ui/src/components/App/index.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export default class JaegerUIApp extends Component {
5858
// Navigate to URL provided on app start
5959
if (isString(window.initialRoutePath) && window.initialRoutePath) {
6060
const urlToNavigate = window.initialRoutePath;
61-
window.initialRoutePath = "";
61+
window.initialRoutePath = '';
6262
history.push(urlToNavigate);
6363
}
6464

packages/jaeger-ui/src/components/SearchTracePage/index.jsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,22 +47,22 @@ const logoUrl = getStaticAssetPath(JaegerLogo);
4747
// Sanitize query params to filter out ones provided by VS Code
4848
const sanitizeQueryParams = params => {
4949
const VS_CODE_PARAMS = [
50-
"id",
51-
"origin",
52-
"swVersion",
53-
"extensionId",
54-
"platform",
55-
"vscode-resource-base-authority",
56-
"parentOrigin"
50+
'id',
51+
'origin',
52+
'swVersion',
53+
'extensionId',
54+
'platform',
55+
'vscode-resource-base-authority',
56+
'parentOrigin',
5757
];
5858

5959
const filteredParams = {};
6060

6161
Object.keys(params).forEach(key => {
6262
if (!VS_CODE_PARAMS.includes(key)) {
63-
filteredParams[key] = params[key]
63+
filteredParams[key] = params[key];
6464
}
65-
})
65+
});
6666

6767
return filteredParams;
6868
};

packages/jaeger-ui/src/components/common/ErrorMessage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ export default function ErrorMessage({
163163
);
164164
}
165165

166-
if (error.message.includes('Failed to fetch')) {
166+
if (error.message.includes('Failed to fetch') || error.httpStatus === 502) {
167167
const isUserDefinedJaegerQueryURL = window.isUserDefinedJaegerQueryURL === true;
168168
return (
169169
<DigmaErrorMessage

packages/jaeger-ui/src/components/common/LoadingIndicator.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,4 @@ limitations under the License.
5252

5353
.LoadingIndicator.is-medium {
5454
font-size: 1.5em;
55-
}
55+
}

packages/jaeger-ui/src/reducers/embedded.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ import { getEmbeddedState, VERSION_0 } from '../utils/embedded-url';
2020
export default function embeddedConfig(state: EmbeddedState | undefined) {
2121
if (state === undefined) {
2222
let search = _get(window, 'location.search');
23-
23+
2424
const params = new URLSearchParams(search);
25-
if (typeof window.embeddedMode === "boolean" && window.embeddedMode && !params.get("uiEmbed")) {
26-
params.set("uiEmbed", VERSION_0);
25+
if (typeof window.embeddedMode === 'boolean' && window.embeddedMode && !params.get('uiEmbed')) {
26+
params.set('uiEmbed', VERSION_0);
2727
search = params.toString();
2828
}
2929

0 commit comments

Comments
 (0)