Skip to content

Commit

Permalink
docker
Browse files Browse the repository at this point in the history
  • Loading branch information
edde746 committed Sep 10, 2024
1 parent 5cfa372 commit 83c979c
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 1 deletion.
34 changes: 34 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Publish to Docker
on:
push:
branches:
- master

permissions:
packages: write
contents: read

jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/edde746/publish-packages/ephnote
tags: type=sha
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build container
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
11 changes: 11 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM node:lts-alpine
WORKDIR /app
RUN npm i -g pnpm
COPY package.json pnpm-lock.yaml ./
RUN pnpm i
RUN pnpm i @sveltejs/adapter-node
COPY . .
RUN sed -i 's/adapter-auto/adapter-node/g' svelte.config.js
RUN pnpm build
RUN pnpm prune --prod
CMD ["node", "build/index.js"]
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,18 @@ For hosting, some viable options are [Vercel](https://vercel.com/) and [Cloudfla
### Environment Variables

The only environment variable required is `REDIS_URL`, which should be set to the connection string of your Redis instance.

## Docker

Example `docker-compose.yml`:
```yaml
services:
ephnote:
image: ghcr.io/edde746/ephnote:latest
ports:
- 3000:3000
environment:
- REDIS_URL=redis://redis:6379
redis:
image: redis:alpine
```
2 changes: 1 addition & 1 deletion svelte.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import adapter from "@sveltejs/adapter-auto";
import adapter from "@sveltejs/adapter-node";
import { vitePreprocess } from "@sveltejs/vite-plugin-svelte";

/** @type {import('@sveltejs/kit').Config} */
Expand Down

0 comments on commit 83c979c

Please sign in to comment.