build: Add docker-compose.yml & image-publish.yml workflow

* Add image-publish CI

* Add docker-compose

* Add Dockerfile

* Add install with docker to README

https://github.com/zyachel/libremdb/pull/7
This commit is contained in:
alefvanoon 2022-07-06 19:38:03 +02:00 committed by GitHub
parent c751d8814d
commit 4bf9a101a6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 70 additions and 1 deletions

38
.github/workflows/image-publish.yml vendored Normal file
View file

@ -0,0 +1,38 @@
name: Build and Deploy to github packages
on:
workflow_dispatch:
inputs:
target:
description: 'Target Branch, tag or SHA'
required: true
default: 'main'
jobs:
buildx:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GHCR_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: |
ghcr.io/${{ github.repository_owner }}/libremdb:latest
ghcr.io/${{ github.repository_owner }}/libremdb:${{ github.event.inputs.target }}
cache-from: type=registry,ref=user/app:latest
cache-to: type=inline

12
Dockerfile Normal file
View file

@ -0,0 +1,12 @@
FROM node:lts-bullseye
WORKDIR /app
RUN apt update -y && apt upgrade -y \
&& apt install -y --no-install-recommends git \
&& apt autoclean -y \
&& apt autoremove -y \
&& rm -rf /var/lib/apt/lists/* \
&& npm install -g pnpm \
&& git clone --depth=1 https://github.com/zyachel/libremdb.git . \
&& pnpm install
EXPOSE 3000
CMD ["pnpm", "start"]

View file

@ -113,7 +113,13 @@ libremdb will start running at http://localhost:3000.
### Docker
There's a [docker image](https://github.com/PussTheCat-org/docker-libremdb-quay) made by [@TheFrenchGhosty](https://github.com/TheFrenchGhosty) for [PussTheCat.org's instance](https://libremdb.pussthecat.org). You can use that in case you wish to use docker.
To run libremdb with Docker, you need to install Docker & docker-compose.
```bash
git clone https://github.com/zyachel/quetre.git # replace gituhb.com with codeberg.org if you wish so.
cd quetre
docker-compose up -d
```
---

13
docker-compose.yml Normal file
View file

@ -0,0 +1,13 @@
services:
libremdb:
container_name: libremdb
image: ghcr.io/zyachel/libremdb:latest
restart: unless-stopped
ports:
- "127.0.0.1:3000:3000" # Replace with "3000:3000" if you don't use a reverse proxy
environment:
- "NODE_ENV=production"
- "PORT=3000"
- "IMAGE_QUALITY=500"
- "CACHE_PERIOD=1h"