-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
74 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
name: Docker images build and push test | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4.2.2 | ||
with: | ||
persist-credentials: false | ||
fetch-depth: 0 | ||
|
||
- name: Get latest release version | ||
run: | | ||
latest_version=$(curl -s https://api.github.com/repos/MCSManager/MCSManager/releases/latest | jq -r .tag_name) | ||
echo "latest_version=$latest_version" >> $GITHUB_ENV | ||
- name: Check local version | ||
run: | | ||
if [ -f ./MCSManager_version ]; then | ||
local_version=$(cat ./MCSManager_version) | ||
else | ||
local_version="none" | ||
fi | ||
echo "local_version=$local_version" >> $GITHUB_ENV | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3.2.0 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3.7.1 | ||
|
||
- name: Login to DockerHub | ||
uses: docker/login-action@v3.3.0 | ||
with: | ||
username: 1lkei | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Docker build-push aio | ||
uses: docker/build-push-action@v6.9.0 | ||
with: | ||
context: . | ||
file: Dockerfile.aio | ||
push: true # push to docker hub | ||
tags: | | ||
1lkei/mcsmanager:latest | ||
1lkei/mcsmanager:${{ env.latest_version }} | ||
build-args: | | ||
LATEST_TAG=${{ env.latest_version }} | ||
platforms: linux/amd64,linux/arm64 | ||
|
||
- name: Commit updated version | ||
if: env.local_version != env.latest_version | ||
run: | | ||
echo "$latest_version" > MCSManager_version | ||
git config user.name "github-actions[bot]" | ||
git config user.email "github-actions[bot]@users.noreply.github.com" | ||
git add MCSManager_version | ||
git commit -m "Update version to $latest_version" | ||
git remote set-url origin https://1lkei:${{ secrets.REPO_BOT }}@github.com/1lkei/mcsmanager-docker.git | ||
git push |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,18 @@ | ||
FROM node:lts-alpine AS builder | ||
|
||
ARG LATEST_TAG | ||
|
||
RUN apk update && \ | ||
apk add --no-cache --virtual .build-deps curl && \ | ||
cd /opt && \ | ||
curl -L -o mcsmanager_linux_release.tar.gz https://github.com/MCSManager/MCSManager/releases/download/$LATEST_TAG/mcsmanager_linux_release.tar.gz && \ | ||
tar -zxf mcsmanager_linux_release.tar.gz && \ | ||
rm -rf mcsmanager_linux_release.tar.gz && \ | ||
apk del .build-deps && \ | ||
rm -rf /var/cache/apk/* | ||
|
||
|
||
FROM node:lts-alpine | ||
|
||
COPY --from=builder /opt/mcsmanager /opt/mcsmanager | ||
ARG LATEST_TAG | ||
COPY entrypoint.sh /entrypoint.sh | ||
|
||
RUN rm -rf /opt/mcsmanager/*.sh && \ | ||
RUN cd /tmp && \ | ||
wget -O /tmp/mcsmanager.tar.gz https://github.com/MCSManager/MCSManager/releases/download/$LATEST_TAG/mcsmanager_linux_release.tar.gz && \ | ||
tar -xf mcsmanager.tar.gz && \ | ||
rm -rf /tmp/mcsmanager/*.sh && \ | ||
mv /tmp/mcsmanager /opt && \ | ||
cd /opt/mcsmanager/daemon && \ | ||
npm install --omit=dev && \ | ||
cd /opt/mcsmanager/web && \ | ||
npm install --omit=dev && \ | ||
chmod +x /entrypoint.sh | ||
chmod +x /entrypoint.sh && \ | ||
rm -rf /tmp/* | ||
|
||
ENTRYPOINT [ "/entrypoint.sh" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters