Merge branch 'master' of github.com:MCSManager/MCSManager

This commit is contained in:
YuMao 2024-10-21 17:44:58 +08:00
commit 3fa9c1e784
3 changed files with 55 additions and 16 deletions

View File

@ -5,7 +5,7 @@ on:
types: [published]
jobs:
build:
build-web:
runs-on: ubuntu-latest
steps:
@ -17,15 +17,7 @@ jobs:
with:
images: |
name=ghcr.io/${{ github.repository }}-web
name=githubyumao/mcsmanager-web
- name: Docker meta daemon
id: meta_daemon
uses: docker/metadata-action@v5
with:
images: |
name=ghcr.io/${{ github.repository }}-daemon
name=githubyumao/mcsmanager-daemon
name=githubyumao/mcsmanager-web,enable=${{ github.repository == 'MCSManager/MCSManager' }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
@ -38,23 +30,62 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to DockerHub
if: ${{ github.repository == 'MCSManager/MCSManager' }}
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Build and Push Web
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
with:
file: dockerfile/web.dockerfile
push: true
tags: ${{ steps.meta_web.outputs.tags }}
labels: ${{ steps.meta_web.outputs.labels }}
build-daemon:
runs-on: ubuntu-latest
strategy:
matrix:
java_version: [8, 11, 17, 21]
steps:
- uses: actions/checkout@v4
- name: Docker meta daemon
id: meta_daemon
uses: docker/metadata-action@v5
with:
images: |
name=ghcr.io/${{ github.repository }}-daemon,enable=${{ matrix.java_version == 21 }}
name=githubyumao/mcsmanager-daemon,enable=${{ github.repository == 'MCSManager/MCSManager' && matrix.java_version == 21 }}
name=ghcr.io/${{ github.repository }}-daemon-jdk${{ matrix.java_version }}
name=githubyumao/mcsmanager-daemon-jdk${{ matrix.java_version }},enable=${{ github.repository == 'MCSManager/MCSManager' }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to ghcr.io
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to DockerHub
if: ${{ github.repository == 'MCSManager/MCSManager' }}
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Build and Push Daemon
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
with:
file: dockerfile/daemon.dockerfile
push: true
tags: ${{ steps.meta_daemon.outputs.tags }}
labels: ${{ steps.meta_daemon.outputs.labels }}
build-args: |
JAVA_RUNTIME=${{ matrix.java_version }}

View File

@ -1,3 +1,5 @@
ARG EMBEDDED_JAVA_VERSION=21
FROM node:lts AS builder
WORKDIR /src
@ -11,7 +13,12 @@ RUN chmod a+x ./install-dependents.sh &&\
RUN wget --input-file=lib-urls.txt --directory-prefix=production-code/daemon/lib/ &&\
chmod a+x production-code/daemon/lib/*
FROM node:lts
FROM eclipse-temurin:${EMBEDDED_JAVA_VERSION}-jdk
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y curl &&\
curl -fsSL https://deb.nodesource.com/setup_20.x | bash &&\
apt-get update && apt-get install -y nodejs && apt-get clean
WORKDIR /opt/mcsmanager/daemon
@ -25,4 +32,4 @@ ENV MCSM_INSTANCES_BASE_PATH=/opt/mcsmanager/daemon/data/InstanceData
VOLUME ["/opt/mcsmanager/daemon/data", "/opt/mcsmanager/daemon/logs"]
CMD [ "app.js", "--max-old-space-size=8192" ]
CMD [ "node", "app.js", "--max-old-space-size=8192" ]

View File

@ -12,8 +12,9 @@ services:
daemon:
image: githubyumao/mcsmanager-daemon:latest
restart: unless-stopped
ports:
- "24444:24444"
network_mode: host # if you want run instance in daemon container
# ports:
# - "24444:24444"
environment:
- MCSM_DOCKER_WORKSPACE_PATH=<CHANGE_ME_TO_INSTALL_PATH>/daemon/data/InstanceData
volumes: