Add Docker deployment #1
No files matched your search
@@ -0,0 +1,8 @@
|
||||
node_modules
|
||||
dist
|
||||
coverage
|
||||
.vite
|
||||
*.log
|
||||
.env
|
||||
.env.*
|
||||
.DS_Store
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
FROM node:22-alpine AS build
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY package.json package-lock.json ./
|
||||
RUN npm ci
|
||||
|
||||
COPY . .
|
||||
RUN npm run build
|
||||
|
||||
FROM nginx:1.27-alpine
|
||||
|
||||
COPY docker/nginx.conf /etc/nginx/conf.d/default.conf
|
||||
COPY --from=build /app/dist/ /usr/share/nginx/html/
|
||||
|
||||
EXPOSE 80
|
||||
|
||||
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
||||
CMD wget -qO- http://127.0.0.1/ >/dev/null || exit 1
|
||||
@@ -86,6 +86,41 @@ npm run build # production build → dist/
|
||||
|
||||
Built with Svelte 5, TypeScript, Vite and TipTap 3 (ProseMirror).
|
||||
|
||||
### Docker
|
||||
|
||||
The production image builds the static application with Node.js and serves it
|
||||
with Nginx. No application server or persistent volume is required; documents
|
||||
remain in the browser.
|
||||
|
||||
Build and run the image directly:
|
||||
|
||||
```bash
|
||||
docker build -t edentext .
|
||||
docker run --rm -p 127.0.0.1:8080:80 edentext
|
||||
```
|
||||
|
||||
Then open <http://localhost:8080>.
|
||||
|
||||
Alternatively, use Docker Compose:
|
||||
|
||||
```bash
|
||||
docker compose up --build -d
|
||||
```
|
||||
|
||||
The Compose service binds EdenText to <http://localhost:8080> by default. To use
|
||||
a different host port, set `EDENTEXT_PORT`, for example:
|
||||
|
||||
```bash
|
||||
EDENTEXT_PORT=8081 docker compose up --build -d
|
||||
```
|
||||
|
||||
Set `EDENTEXT_BIND_ADDRESS=0.0.0.0` to make the service reachable from other
|
||||
machines. When finished, stop and remove it with:
|
||||
|
||||
```bash
|
||||
docker compose down
|
||||
```
|
||||
|
||||
## Contributing
|
||||
|
||||
Contributions are welcome — see [CONTRIBUTING.md](CONTRIBUTING.md). Merging
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
services:
|
||||
edentext:
|
||||
build:
|
||||
context: .
|
||||
image: edentext:local
|
||||
ports:
|
||||
- "${EDENTEXT_BIND_ADDRESS:-127.0.0.1}:${EDENTEXT_PORT:-8080}:80"
|
||||
restart: unless-stopped
|
||||
@@ -0,0 +1,18 @@
|
||||
server {
|
||||
listen 80;
|
||||
server_name _;
|
||||
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
add_header Cache-Control "no-cache";
|
||||
}
|
||||
|
||||
location /assets/ {
|
||||
expires 1y;
|
||||
add_header Cache-Control "public, immutable";
|
||||
try_files $uri =404;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user