Skip to content

Commit

Permalink
working on build script for docker images and browser extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
cars10 committed Jun 25, 2023
1 parent 4996eb1 commit b72fe50
Show file tree
Hide file tree
Showing 63 changed files with 1,757 additions and 2,242 deletions.
31 changes: 26 additions & 5 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,32 @@
# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*packj
*.njsproj
*.sln
*.sw?

# Tool logs
npm-debug.log
yarn-*.log

artifacts
browser_extension
# Tests
/test-results/
/playwright-report/
/playwright/.cache/
playwright/.auth
tests/*.png

artifacts/*
dist
node_modules
tests
browser_extension/*
!browser_extension/chrome/background.js
!browser_extension/chrome/manifest.json
!browser_extension/firefox/background.js
!browser_extension/firefox/manifest.json
tmp

old
src-tauri/target
32 changes: 16 additions & 16 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@ jobs:
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
- name: Install dependencies
run: yarn
- name: Install Playwright Browsers
run: yarn playwright install --with-deps
- name: Run Playwright tests
run: yarn playwright test
- uses: actions/upload-artifact@v3
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 30
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
- name: Install dependencies
run: yarn
- name: Install Playwright Browsers
run: yarn playwright install --with-deps
- name: Run Playwright tests
run: yarn playwright test
- uses: actions/upload-artifact@v3
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 30
30 changes: 16 additions & 14 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,17 +1,3 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
Expand All @@ -23,8 +9,24 @@ dist-ssr
*.sln
*.sw?

# Tool logs
npm-debug.log
yarn-*.log

# Tests
/test-results/
/playwright-report/
/playwright/.cache/
playwright/.auth
tests/*.png

artifacts/*
dist
node_modules
browser_extension/*
!browser_extension/chrome/background.js
!browser_extension/chrome/manifest.json
!browser_extension/firefox/background.js
!browser_extension/firefox/manifest.json
tmp
src-tauri/target
8 changes: 4 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -368,8 +368,8 @@ case.
### 0.12.0

* improvements for the code editor (json views):
* [feat] enable searchbox for code editor
* [feat] add beautify button to code editor (hotkey: ctrl+alt+l)
* [feat] enable searchbox for code editor
* [feat] add beautify button to code editor (hotkey: ctrl+alt+l)
* [feat] show different "no results" text in results table based on current filters. thx @georgeyeint (see discussion
in [#7][i7])
* [bug] fix switching between index pattern and index selection ([#7][i7])
Expand Down Expand Up @@ -417,8 +417,8 @@ case.
### 0.9.0

* snapshot management
* create and remove snapshot repositories
* take and restore snapshots for all/specific indices
* create and remove snapshot repositories
* take and restore snapshots for all/specific indices
* updates dependencies (vue 2.6, vuetify 1.5)

### 0.8.0
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

## Bugs / Feature requests

Please use one of the provided [issue templates](https://github.com/cars10/elasticvue/issues/new/choose) and create an issue.

Please use one of the provided [issue templates](https://github.com/cars10/elasticvue/issues/new/choose) and create an
issue.

## Development

Expand Down
26 changes: 17 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
.PHONY: docker

dev:
yarn dev

docker:
docker build -f docker/Dockerfile -t elasticvue .

test:
yarn test:e2e:all

Expand All @@ -15,4 +7,20 @@ lint:
tsc:
yarn tsc

ci: tsc lint test
ci: tsc lint test

tauri:
yarn tauri:build

# Build docker image to run elasticvue served by nginx
docker_nginx:
docker build -f docker/Dockerfile -t elasticvue .

# Build docker image to run elasticvue served by nginx MULTIARCH
docker_nginx_multiarch:
docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t elasticvue -f docker/Dockerfile_multiarch .

# Build elasticvue browser extensions into ./artifacts via docker
browser_ext:
docker build -f docker/Dockerfile_browser_ext -t elasticvue:build_browser_ext .
docker run --rm -v ./artifacts:/app/artifacts elasticvue:build_browser_ext scripts/build_browser_extensions.sh
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,22 @@ Current State:
| Snapshots | Done |
| Settings | Done |


Features that are no longer re-implemented:

* Nodes grid view
* Rest query vertical view
* Support for numbers bigger then `Number.MAX_SAFE_INTEGER`
* Utilities

Overall TODOs:

* Cleanup i18n
* a11y
* keyup.esc modifiers
* responsiveness

## Makefile

`make dev` start dev server
`make docker` build docker image
`make test` run tests
Expand Down
3 changes: 3 additions & 0 deletions browser_extension/chrome/background.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
chrome.action.onClicked.addListener(function () {
chrome.tabs.create({ url: chrome.runtime.getURL('index.html') })
})
20 changes: 20 additions & 0 deletions browser_extension/chrome/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "Elasticvue",
"version": "0.44.0",
"description": "Elasticsearch frontend",
"manifest_version": 3,
"icons": {
"16": "./logo/blue_16.png",
"32": "./logo/blue_32.png",
"48": "./logo/blue_48.png",
"128": "./logo/blue_128.png"
},
"background": {
"service_worker": "background.js"
},
"action": {},
"host_permissions": [
"http://*/*",
"https://*/*"
]
}
3 changes: 3 additions & 0 deletions browser_extension/firefox/background.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
chrome.browserAction.onClicked.addListener(function () {
chrome.tabs.create({ url: chrome.runtime.getURL('index.html') })
})
23 changes: 23 additions & 0 deletions browser_extension/firefox/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "Elasticvue",
"version": "0.44.0",
"description": "Elasticsearch frontend",
"manifest_version": 2,
"icons": {
"16": "./logo/blue_16.png",
"32": "./logo/blue_32.png",
"48": "./logo/blue_48.png",
"128": "./logo/blue_128.png"
},
"background": {
"scripts": [
"background.js"
],
"persistent": true
},
"browser_action": {},
"permissions": [
"http://*/*",
"https://*/*"
]
}
9 changes: 5 additions & 4 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
FROM node:18-alpine AS builder
WORKDIR /usr/src/app
FROM node:18-bookworm AS builder
RUN mkdir /app
WORKDIR /app

COPY package.json .
COPY yarn.lock .

RUN yarn install --ignore-optional
COPY . .
RUN yarn build
RUN yarn build -l silent

FROM nginx:mainline-alpine
COPY --from=builder /usr/src/app/dist /usr/share/nginx/html
COPY --from=builder /app/dist /usr/share/nginx/html
RUN rm /etc/nginx/conf.d/default.conf
COPY docker/nginx/elasticvue.conf /etc/nginx/conf.d/
22 changes: 22 additions & 0 deletions docker/Dockerfile_browser_ext
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM node:18-bookworm
RUN mkdir /app
WORKDIR /app

RUN npm install --global web-ext

RUN apt-get update -qq \
&& apt-get upgrade -y \
&& apt-get install -y \
zip \
&& apt-get clean \
&& apt-get autoclean \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/*

COPY package.json .
COPY yarn.lock .

RUN yarn install --ignore-optional
COPY . .

ENTRYPOINT ["/bin/bash"]
9 changes: 5 additions & 4 deletions docker/Dockerfile_multiarch
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
FROM --platform=$BUILDPLATFORM node:18-alpine AS builder
WORKDIR /usr/src/app
FROM --platform=$BUILDPLATFORM node:18-bookworm AS builder
RUN mkdir /app
WORKDIR /app

COPY package.json .
COPY yarn.lock .

RUN yarn install --ignore-optional
COPY . .
RUN yarn build
RUN yarn build -l silent

FROM nginx:mainline-alpine
COPY --from=builder /usr/src/app/dist /usr/share/nginx/html
COPY --from=builder /app/dist /usr/share/nginx/html
RUN rm /etc/nginx/conf.d/default.conf
COPY docker/nginx/elasticvue.conf /etc/nginx/conf.d/
2 changes: 0 additions & 2 deletions docker/nginx/elasticvue.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ server {
server_name _;
root /usr/share/nginx/html;

access_log off;

location / {
try_files $uri $uri/ /index.html?$args;
}
Expand Down
20 changes: 10 additions & 10 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Elasticvue</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/src/assets/images/icons/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Elasticvue</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
3 changes: 0 additions & 3 deletions old/src/assets/icons/caret.svg

This file was deleted.

11 changes: 0 additions & 11 deletions old/src/assets/icons/flags/cn.svg

This file was deleted.

7 changes: 0 additions & 7 deletions old/src/assets/icons/flags/en.svg

This file was deleted.

1 change: 0 additions & 1 deletion old/src/assets/index.js

This file was deleted.

Loading

0 comments on commit b72fe50

Please sign in to comment.