瀏覽代碼

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
alefvanoon 3 年之前
父節點
當前提交
4bf9a101a6
共有 4 個文件被更改,包括 70 次插入1 次删除
  1. 38 0
      .github/workflows/image-publish.yml
  2. 12 0
      Dockerfile
  3. 7 1
      README.md
  4. 13 0
      docker-compose.yml

+ 38 - 0
.github/workflows/image-publish.yml

@@ -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 - 0
Dockerfile

@@ -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"]

+ 7 - 1
README.md

@@ -113,7 +113,13 @@ libremdb will start running at http://localhost:3000.
 
 
 ### Docker
 ### 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 - 0
docker-compose.yml

@@ -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"