Add Enigma BBS deployment files
Some checks failed
Build and Push Docker Image / build (push) Has been cancelled

This commit is contained in:
capitano
2026-04-06 11:07:27 +02:00
parent ed614eb436
commit 6a39457989
8 changed files with 338 additions and 0 deletions

View File

@@ -0,0 +1,46 @@
name: Build and Push Docker Image
on:
push:
branches:
- main
paths:
- 'Dockerfile'
- '.gitea/**/*.yaml'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Container Registry
uses: docker/login-action@v3
with:
registry: git.giaco.net
username: ${{ vars.GIT_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: git.giaco.net/enigma/enigmabbs
tags: |
type=ref,event=branch
type=raw,value=latest
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max

82
Dockerfile Normal file
View File

@@ -0,0 +1,82 @@
# Build stage
FROM --platform=${BUILDPLATFORM:-linux/amd64} node:20-bookworm-slim AS builder
ARG TARGETPLATFORM
ARG BUILDPLATFORM
ARG TARGETOS
ENV NVM_DIR /root/.nvm \
DEBIAN_FRONTEND=noninteractive
RUN apt-get update \
&& apt-get install -y \
git curl build-essential python3 libssl-dev \
lrzsz arj lhasa unrar-free p7zip-full dos2unix \
&& npm set progress=false && npm config set depth 0 \
&& npm install -g npm@latest pm2
WORKDIR /tmp
RUN git clone --depth 1 https://github.com/NuSkooler/enigma-bbs.git enigma-bbs-source \
&& cd enigma-bbs-source \
&& npm install --ignore-scripts \
&& dos2unix docker/bin/docker-entrypoint.sh \
&& dos2unix autoexec.sh
# Runtime stage
FROM node:20-bookworm-slim
ARG TARGETPLATFORM
ARG BUILDPLATFORM
ARG TARGETOS
LABEL maintainer="dave@force9.org"
ENV NVM_DIR=/root/.nvm \
DEBIAN_FRONTEND=noninteractive \
PATH=/root/.npm-global/bin:/usr/local/bin:/usr/bin:/bin \
BBS_ROOT_DIR=/enigma-bbs \
BBS_STAGING_PATH=/enigma-bbs-pre
RUN apt-get update && apt-get install -y \
git curl \
lrzsz arj lhasa unrar-free p7zip-full \
&& apt-get remove dos2unix -y \
&& apt-get autoremove -y \
&& npm set progress=false \
&& npm install -g pm2 \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
WORKDIR /${BBS_ROOT_DIR}
COPY --from=builder /tmp/enigma-bbs-source/ ${BBS_ROOT_DIR}/
COPY --from=builder /usr/local/bin/sexyz /usr/local/bin/
RUN dos2unix ${BBS_ROOT_DIR}/docker/bin/docker-entrypoint.sh \
&& cp -f ${BBS_ROOT_DIR}/docker/bin/sexyz /usr/local/bin \
&& mkdir -p ${BBS_STAGING_PATH}/art \
&& mkdir -p ${BBS_STAGING_PATH}/mods \
&& mkdir -p ${BBS_STAGING_PATH}/config \
&& cp -rp ${BBS_ROOT_DIR}/art/* ${BBS_STAGING_PATH}/art/ \
&& cp -rp ${BBS_ROOT_DIR}/mods/* ${BBS_STAGING_PATH}/mods/ \
&& cp -rp ${BBS_ROOT_DIR}/config/* ${BBS_STAGING_PATH}/config/ \
&& rm -rf ${BBS_ROOT_DIR}/art/* \
&& rm -rf ${BBS_ROOT_DIR}/mods/* \
&& rm -rf ${BBS_ROOT_DIR}/config \
&& ln -s ${BBS_STAGING_PATH}/config ${BBS_ROOT_DIR}/config \
&& pm2 start ${BBS_ROOT_DIR}/main.js \
&& rm -rf ${BBS_STAGING_PATH}/config
VOLUME ${BBS_ROOT_DIR}/art \
${BBS_ROOT_DIR}/config \
${BBS_ROOT_DIR}/db \
${BBS_ROOT_DIR}/filebase \
${BBS_ROOT_DIR}/logs \
${BBS_ROOT_DIR}/mods \
/mail
EXPOSE 8888 44510 44511
WORKDIR ${BBS_ROOT_DIR}
ENTRYPOINT ["/enigma-bbs/docker/bin/docker-entrypoint.sh"]

21
build-image.sh Executable file
View File

@@ -0,0 +1,21 @@
# BuildEnigmaBBS
# Questo script costruisce l'immagine Enigma BBS localmente
# Requires: Docker
set -e
cd "$(dirname "$0")"
echo "Building Enigma BBS Docker image..."
docker build -t enigmabbs:latest \
--build-arg TARGETPLATFORM=linux/amd64 \
--build-arg BUILDPLATFORM=linux/amd64 \
--build-arg TARGETOS=linux \
--build-arg BUILD_BRANCH=master \
https://github.com/NuSkooler/enigma-bbs.git
echo "Build complete! Image: enigmabbs:latest"
echo ""
echo "To push to your registry:"
echo " docker tag enigmabbs:latest <your-registry>/enigmabbs:latest"
echo " docker push <your-registry>/enigmabbs:latest"

41
configmap.yaml Normal file
View File

@@ -0,0 +1,41 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: enigmabbs-config
namespace: enigmabbs
data:
config.hjson: |
{
system: {
bbsName: "Enigma BBS"
bbsTimeZone: "America/New_York"
bbsNodeNumber: 1
domain: "enigma.giaco.net"
}
loginServers: {
telnet: {
enabled: true
port: 8888
}
ssh: {
enabled: true
port: 44511
}
}
contentServers: {
web: {
domain: "enigma.giaco.net"
http: {
enabled: true
port: 8888
}
}
}
security: {
secureLoginOnly: false
requireSecureConnections: false
}
}

76
deployment.yaml Normal file
View File

@@ -0,0 +1,76 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: enigmabbs
namespace: enigmabbs
spec:
replicas: 1
selector:
matchLabels:
app: enigmabbs
template:
metadata:
labels:
app: enigmabbs
spec:
containers:
- name: enigmabbs
image: git.giaco.net/enigma/enigmabbs:latest
ports:
- containerPort: 8888
name: web
- containerPort: 44510
name: telnet
- containerPort: 44511
name: ssh
env:
- name: NODE_ENV
value: "production"
volumeMounts:
- name: enigmabbs-data
mountPath: /enigma-bbs/db
- name: enigmabbs-art
mountPath: /enigma-bbs/art
- name: enigmabbs-config-volume
mountPath: /enigma-bbs/config
- name: enigmabbs-mods
mountPath: /enigma-bbs/mods
- name: enigmabbs-logs
mountPath: /enigma-bbs/logs
resources:
requests:
memory: "512Mi"
cpu: "500m"
limits:
memory: "2Gi"
cpu: "1000m"
readinessProbe:
tcpSocket:
port: 8888
initialDelaySeconds: 60
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 3
livenessProbe:
tcpSocket:
port: 8888
initialDelaySeconds: 120
periodSeconds: 20
timeoutSeconds: 10
failureThreshold: 3
volumes:
- name: enigmabbs-data
persistentVolumeClaim:
claimName: enigmabbs-data
- name: enigmabbs-art
persistentVolumeClaim:
claimName: enigmabbs-art
- name: enigmabbs-config-volume
configMap:
name: enigmabbs-config
- name: enigmabbs-mods
persistentVolumeClaim:
claimName: enigmabbs-mods
- name: enigmabbs-logs
persistentVolumeClaim:
claimName: enigmabbs-logs

6
namespace.yaml Normal file
View File

@@ -0,0 +1,6 @@
apiVersion: v1
kind: Namespace
metadata:
name: enigmabbs
labels:
name: enigmabbs

47
pvc.yaml Normal file
View File

@@ -0,0 +1,47 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: enigmabbs-data
namespace: enigmabbs
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: enigmabbs-art
namespace: enigmabbs
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 500Mi
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: enigmabbs-mods
namespace: enigmabbs
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 500Mi
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: enigmabbs-logs
namespace: enigmabbs
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 500Mi

19
service.yaml Normal file
View File

@@ -0,0 +1,19 @@
apiVersion: v1
kind: Service
metadata:
name: enigmabbs
namespace: enigmabbs
spec:
type: LoadBalancer
selector:
app: enigmabbs
ports:
- name: web
port: 8888
targetPort: 8888
- name: telnet
port: 44510
targetPort: 44510
- name: ssh
port: 44511
targetPort: 44511