diff --git a/README.md b/README.md index d6fd87ed..094c5416 100644 --- a/README.md +++ b/README.md @@ -55,6 +55,7 @@ If you need help with Termix, you can join the [Discord](https://discord.gg/jVQG # Show-off ![Demo Image](repo-images/DemoImage1.png) +![Demo Image](repo-images/DemoImage2.png) # License Distributed under the MIT license. See LICENSE for more information. diff --git a/docker/Dockerfile b/docker/Dockerfile index 90e23363..8db6b186 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,5 +1,5 @@ # Stage 1: Build frontend -FROM --platform=$BUILDPLATFORM node:18-alpine AS frontend-builder +FROM --platform=$BUILDPLATFORM node:18 AS frontend-builder WORKDIR /app COPY package*.json ./ RUN npm install @@ -7,7 +7,7 @@ COPY . . RUN npm run build # Stage 2: Build backend -FROM --platform=$BUILDPLATFORM node:18-alpine AS backend-builder +FROM --platform=$BUILDPLATFORM node:18 AS backend-builder WORKDIR /app COPY package*.json ./ RUN npm install @@ -19,6 +19,8 @@ FROM mongo:5 RUN apt-get update && apt-get install -y \ curl \ nginx \ + python3 \ + build-essential \ && curl -fsSL https://deb.nodesource.com/setup_18.x | bash - \ && apt-get install -y nodejs \ && apt-get clean \ @@ -28,8 +30,10 @@ RUN apt-get update && apt-get install -y \ COPY docker/nginx.conf /etc/nginx/nginx.conf COPY --from=frontend-builder /app/dist /usr/share/nginx/html -# Copy backend -COPY --from=backend-builder /app/node_modules ./node_modules +# Setup backend +WORKDIR /app +COPY package*.json ./ +RUN npm install --omit=dev COPY --from=backend-builder /app/src/backend ./src/backend # Create directories for MongoDB and nginx diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index 22a09ee2..f372ddc8 100644 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -1,23 +1,32 @@ #!/bin/bash +set -e # Start MongoDB +echo "Starting MongoDB..." mongod --fork --dbpath $MONGODB_DATA_DIR --logpath $MONGODB_LOG_DIR/mongodb.log # Wait for MongoDB to be ready echo "Waiting for MongoDB to start..." -until mongo --eval "print(\"waited for connection\")" > /dev/null 2>&1; do +until mongosh --eval "print(\"waited for connection\")" > /dev/null 2>&1; do sleep 0.5 done echo "MongoDB has started" # Start nginx +echo "Starting nginx..." nginx +# Change to app directory +cd /app + # Start the SSH service +echo "Starting SSH service..." node src/backend/ssh.cjs & # Start the database service +echo "Starting database service..." node src/backend/database.cjs & # Keep the container running and show MongoDB logs +echo "All services started. Tailing MongoDB logs..." tail -f $MONGODB_LOG_DIR/mongodb.log \ No newline at end of file diff --git a/repo-images/DemoImage1.png b/repo-images/DemoImage1.png index 68f6e262..87d3e82e 100644 Binary files a/repo-images/DemoImage1.png and b/repo-images/DemoImage1.png differ diff --git a/repo-images/DemoImage2.png b/repo-images/DemoImage2.png new file mode 100644 index 00000000..6fb8a048 Binary files /dev/null and b/repo-images/DemoImage2.png differ