mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 02:30:08 -08:00
Merge 102ec9b4f4 into b50b14ba96
This commit is contained in:
commit
8b4258569b
5 changed files with 113 additions and 0 deletions
3
.dockerignore
Normal file
3
.dockerignore
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
# .dockerignore
|
||||
Dockerfile
|
||||
docker-compose.yml
|
||||
44
.github/workflows/docker-build.yml
vendored
Normal file
44
.github/workflows/docker-build.yml
vendored
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
name: build & push docker container
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- '*'
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
jobs:
|
||||
docker:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Docker meta
|
||||
id: metal
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: |
|
||||
ghcr.io/${{ github.repository }}
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
- name: Login to GitHub Container Registry
|
||||
if: github.event_name != 'pull_request'
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ github.token }}
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: ${{ github.event_name != 'pull_request' }}
|
||||
tags: ${{ steps.metal.outputs.tags }}
|
||||
labels: ${{ steps.metal.outputs.labels }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
31
Dockerfile
Normal file
31
Dockerfile
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
FROM maven:3.9 AS builder
|
||||
|
||||
COPY . .
|
||||
RUN mvn clean install -DskipTests \
|
||||
&& cd ./Mage.Server \
|
||||
&& mvn package assembly:single
|
||||
|
||||
FROM openjdk:8-jre
|
||||
|
||||
ENV MAGE_SERVER_ADDRESS="0.0.0.0" \
|
||||
MAGE_PORT="17171" \
|
||||
MAGE_SECONDARY_BIND_PORT="17179" \
|
||||
MAGE_MAX_SECONDS_IDLE="600" \
|
||||
MAGE_AUTHENTICATION_ACTIVATED="false" \
|
||||
MAGE_SERVER_NAME="mage-server"
|
||||
|
||||
EXPOSE 17171 17179
|
||||
WORKDIR /xmage
|
||||
|
||||
COPY --from=builder Mage.Server/target/mage-server.zip .
|
||||
|
||||
RUN unzip mage-server.zip \
|
||||
&& rm mage-server.zip
|
||||
|
||||
COPY dockerContainerStart.sh /xmage/
|
||||
|
||||
RUN chmod +x \
|
||||
/xmage/startServer.sh \
|
||||
/xmage/dockerContainerStart.sh
|
||||
|
||||
CMD [ "./dockerContainerStart.sh" ]
|
||||
23
docker-compose.yml
Normal file
23
docker-compose.yml
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
services:
|
||||
server:
|
||||
build: .
|
||||
image: ghcr.io/magefree/mage
|
||||
ports:
|
||||
- '17171:17171'
|
||||
- '17179:17179'
|
||||
extra_hosts:
|
||||
# Adjust this to configure the server for your deployment URL (`localhost` -> `yourDomain.com`)
|
||||
- 'localhost:0.0.0.0'
|
||||
environment:
|
||||
# Adjust this to configure the server for your deployment URL (`localhost` -> `yourDomain.com`)
|
||||
- MAGE_SERVER_ADDRESS=localhost
|
||||
# Give the server a name, if you want to
|
||||
- MAGE_SERVER_NAME=mage-server
|
||||
- MAGE_MAX_SECONDS_IDLE=6000
|
||||
- MAGE_AUTHENTICATION_ACTIVATED=false
|
||||
volumes:
|
||||
- xmage-db:/xmage/db
|
||||
- xmage-saved:/xmage/saved
|
||||
volumes:
|
||||
xmage-db:
|
||||
xmage-saved:
|
||||
12
dockerContainerStart.sh
Normal file
12
dockerContainerStart.sh
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
#!/bin/sh
|
||||
|
||||
XMAGE_CONFIG=/xmage/config/config.xml
|
||||
|
||||
sed -i -e "s#\(serverAddress=\)[\"].*[\"]#\1\"$MAGE_SERVER_ADDRESS\"#g" ${XMAGE_CONFIG}
|
||||
sed -i -e "s#\(serverName=\)[\"].*[\"]#\1\"$MAGE_SERVER_NAME\"#g" ${XMAGE_CONFIG}
|
||||
sed -i -e "s#\(port=\)[\"].*[\"]#\1\"$MAGE_PORT\"#g" ${XMAGE_CONFIG}
|
||||
sed -i -e "s#\(secondaryBindPort=\)[\"].*[\"]#\1\"$MAGE_SECONDARY_BIND_PORT\"#g" ${XMAGE_CONFIG}
|
||||
sed -i -e "s#\(maxSecondsIdle=\)[\"].*[\"]#\1\"$MAGE_MAX_SECONDS_IDLE\"#g" ${XMAGE_CONFIG}
|
||||
sed -i -e "s#\(authenticationActivated=\)[\"].*[\"]#\1\"$MAGE_AUTHENTICATION_ACTIVATED\"#g" ${XMAGE_CONFIG}
|
||||
|
||||
java -Xms256M -Xmx512M -XX:MaxPermSize=256m -Djava.security.policy=./config/security.policy -Djava.util.logging.config.file=./config/logging.config -Dlog4j.configuration=file:./config/log4j.properties -jar ./lib/mage-server-*.jar
|
||||
Loading…
Add table
Add a link
Reference in a new issue