Skip to content

Commit 6d1b544

Browse files
committed
Set up package
1 parent 77eae54 commit 6d1b544

File tree

6 files changed

+139
-3
lines changed

6 files changed

+139
-3
lines changed

.dockerignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
node_modules
2+
eca-webview/node_modules
3+
dist
4+
.git
5+
.github
6+
.gitmodules
7+
*.md
8+
!README.md
9+
LICENSE
10+
CNAME
11+
.DS_Store

.github/workflows/docker.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Build and Push Docker Image
2+
3+
on:
4+
push:
5+
branches: [master]
6+
tags: ["v*"]
7+
workflow_dispatch:
8+
9+
env:
10+
IMAGE: ghcr.io/${{ github.repository }}
11+
12+
permissions:
13+
contents: read
14+
packages: write
15+
16+
jobs:
17+
docker:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v4
21+
with:
22+
submodules: true
23+
24+
- uses: docker/setup-buildx-action@v3
25+
26+
- uses: docker/login-action@v3
27+
with:
28+
registry: ghcr.io
29+
username: ${{ github.actor }}
30+
password: ${{ secrets.GITHUB_TOKEN }}
31+
32+
- uses: docker/metadata-action@v5
33+
id: meta
34+
with:
35+
images: ${{ env.IMAGE }}
36+
tags: |
37+
type=raw,value=latest,enable={{is_default_branch}}
38+
type=sha,prefix=
39+
type=semver,pattern={{version}}
40+
type=semver,pattern={{major}}.{{minor}}
41+
42+
- uses: docker/build-push-action@v6
43+
with:
44+
context: .
45+
push: true
46+
tags: ${{ steps.meta.outputs.tags }}
47+
labels: ${{ steps.meta.outputs.labels }}
48+
cache-from: type=gha
49+
cache-to: type=gha,mode=max

Dockerfile

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Stage 1: Build the app
2+
FROM node:20-alpine AS build
3+
WORKDIR /app
4+
5+
COPY package.json package-lock.json ./
6+
RUN npm ci
7+
8+
# Copy source and the eca-webview submodule
9+
COPY src/ src/
10+
COPY eca-webview/ eca-webview/
11+
COPY index.html tsconfig.json tsconfig.node.json vite.config.ts ./
12+
COPY public/ public/
13+
14+
RUN npm run build
15+
16+
# Stage 2: Serve with nginx
17+
FROM nginx:alpine
18+
19+
COPY nginx.conf /etc/nginx/conf.d/default.conf
20+
COPY --from=build /app/dist /usr/share/nginx/html
21+
22+
EXPOSE 80
23+
24+
CMD ["nginx", "-g", "daemon off;"]

README.md

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,34 @@ eca-web/
4545

4646
The `eca-webview/` directory is a **git submodule** containing the shared webview UI used by the VS Code extension, IntelliJ plugin, and this web app. The Vite alias `@webview` points to `eca-webview/src`.
4747

48-
## Setup
48+
## Run locally with Docker
49+
50+
The fastest way to run eca-web on your machine — no Node.js required:
51+
52+
```bash
53+
docker run -p 8080:80 ghcr.io/editor-code-assistant/eca-web
54+
```
55+
56+
Then open [http://localhost:8080](http://localhost:8080).
57+
58+
Or using Docker Compose:
59+
60+
```bash
61+
# Download the compose file (or clone the repo)
62+
curl -O https://raw.githubusercontent.com/editor-code-assistant/eca-web/master/docker-compose.yml
63+
64+
docker compose up
65+
```
66+
67+
### Available tags
68+
69+
| Tag | Description |
70+
|-----|-------------|
71+
| `latest` | Latest build from `master` |
72+
| `<sha>` | Pinned to a specific commit |
73+
| `<version>` | Semantic version (e.g. `1.0.0`, `1.0`) when tagged |
74+
75+
## Development setup
4976

5077
```bash
5178
git clone --recurse-submodules https://github.com/editor-code-assistant/eca-web.git
@@ -59,8 +86,6 @@ If you already cloned without `--recurse-submodules`:
5986
git submodule update --init
6087
```
6188

62-
## Development
63-
6489
```bash
6590
npm run dev # Start dev server on http://localhost:5180
6691
npm run build # Type-check + production build → dist/

docker-compose.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
services:
2+
eca-web:
3+
image: ghcr.io/editor-code-assistant/eca-web:latest
4+
ports:
5+
- "8080:80"

nginx.conf

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
server {
2+
listen 80;
3+
root /usr/share/nginx/html;
4+
index index.html;
5+
6+
# SPA: serve index.html for all routes not matching a real file
7+
location / {
8+
try_files $uri $uri/ /index.html;
9+
}
10+
11+
# Cache static assets aggressively (Vite hashes filenames)
12+
location /assets/ {
13+
expires 1y;
14+
add_header Cache-Control "public, immutable";
15+
}
16+
17+
# Disable caching for index.html so new deploys take effect
18+
location = /index.html {
19+
expires -1;
20+
add_header Cache-Control "no-store, no-cache, must-revalidate";
21+
}
22+
}

0 commit comments

Comments
 (0)