Преглед изворни кода

Merge pull request #195 from shuguet/main

feat: Add support for running Puter self-hosted using the automatically built Docker image
Eric Dubé пре 1 година
родитељ
комит
15fcc5680f
5 измењених фајлова са 41 додато и 11 уклоњено
  1. 2 0
      .dockerignore
  2. 3 1
      .gitignore
  3. 5 3
      Dockerfile
  4. 8 2
      README.md
  5. 23 5
      docker-compose.yml

+ 2 - 0
.dockerignore

@@ -1,3 +1,5 @@
 .dockerignore
 Dockerfile
 node_modules
+config
+data

+ 3 - 1
.gitignore

@@ -8,4 +8,6 @@ dist/
 .vscode/
 .env
 # this is for jetbrain IDEs
-.idea/
+.idea/
+config
+data

+ 5 - 3
Dockerfile

@@ -3,10 +3,10 @@ FROM node:21-alpine
 # Set labels
 LABEL repo="https://github.com/HeyPuter/puter"
 LABEL license="AGPL-3.0,https://github.com/HeyPuter/puter/blob/master/LICENSE.txt"
-LABEL version="v1.2.40-beta"
+LABEL version="1.2.46-beta-1"
 
-# Debugging
-RUN apk add --no-cache bash # useful for debugging
+# Install git (required by Puter to check version)
+RUN apk add --no-cache git
 
 # Setup working directory
 RUN mkdir -p /opt/puter/app
@@ -26,5 +26,7 @@ RUN npm cache clean --force \
 
 EXPOSE 4100
 
+HEALTHCHECK  --interval=30s --timeout=3s \
+  CMD wget --no-verbose --tries=1 --spider http://puter.localhost:4100/test || exit 1
 
 CMD [ "npm", "start" ]

+ 8 - 2
README.md

@@ -45,8 +45,14 @@ This will launch Puter at http://localhost:4000 (or the next available port).
 ### Using Docker
 
 ```bash
-git clone https://github.com/HeyPuter/puter
-cd puter
+docker run --rm -p 4100:4100 -v `pwd`/data:/opt/puter/app/volatile/runtime -v `pwd`/config:/opt/puter/app/volatile/config ghcr.io/heyputer/puter
+```
+
+### Using Docker Compose
+
+```bash
+mkdir puter && cd puter
+wget https://raw.githubusercontent.com/HeyPuter/puter/main/docker-compose.yml
 docker compose up
 ```
 

+ 23 - 5
docker-compose.yml

@@ -1,7 +1,25 @@
-version: '3'
-
+---
+version: "3.8"
 services:
-  app:
-    build: ./
+  puter:
+    container_name: puter
+    image: ghcr.io/heyputer/puter:latest
+    pull_policy: always
+    # build: ./
+    restart: unless-stopped
     ports:
-      - 4100:4100    
+      - '4100:4100'
+    environment:
+      # TZ: Europe/Paris
+      # CONFIG_PATH: /etc/puter
+      PUID: 1000
+      PGID: 1000
+    volumes:
+      - ./config:/opt/puter/app/volatile/config
+      - ./data:/opt/puter/app/volatile/runtime
+    healthcheck:
+      test: wget --no-verbose --tries=1 --spider http://puter.localhost:4100/test || exit 1
+      interval: 30s
+      timeout: 3s
+      retries: 3
+      start_period: 30s