Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,23 @@ task:
- yarn build
Test_script:
- yarn test:main

docker_builder:
name: Docker
# only_if: $CIRRUS_TAG != ''
depends_on:
- Build
env:
DOCKER_USERNAME: ENCRYPTED[...]
DOCKER_PASSWORD: ENCRYPTED[...]
get_artifact_script:
- apt update --yes
- apt install unzip curl --yes
- curl -L "https://api.cirrus-ci.com/v1/artifact/build/$CIRRUS_BUILD_ID/Build/Peacock_Release.zip" -o Peacock.zip
- unzip Peacock.zip
- unzip Peacock-v*-linux.zip
- rm Peacock*.zip
build_script: docker build --tag thepeacockproject/peacock:latest .
# build_script: docker build --tag thepeacockproject/peacock:$CIRRUS_TAG --tag thepeacockproject/peacock:latest .
# login_script: docker login --username $DOCKER_USERNAME --password $DOCKER_PASSWORD
# push_script: docker push thepeacockproject/peacock:$CIRRUS_TAG && docker push thepeacockproject/peacock:latest
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,5 @@ DEBUG_PROFILE.zip
packaging/add_itemsize/*
!packaging/add_itemsize/add_itemsize.js
/.idea/AIAssistantCustomInstructionsStorage.xml

config/
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's this for?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh that's a directory I had made for mounting the container in while testing. I can remove that line if needed

18 changes: 18 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM node:22.13.0-alpine3.21

RUN apk add --update su-exec shadow jq

RUN rm -rf /var/cache/apk/*

RUN mkdir /app_build
RUN mkdir /app_linux
WORKDIR /app_build

COPY . .

RUN chmod +x packaging/docker-build.sh
RUN chmod +x packaging/entrypoint.sh

RUN packaging/docker-build.sh

ENTRYPOINT ["./packaging/entrypoint.sh"]
8 changes: 4 additions & 4 deletions packaging/ciAssemble.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ fi
# generate options.ini
node chunk0.js noop

mkdir "$OUT_DIR"
mkdir -p "$OUT_DIR"
cp packaging/HOW_TO_USE.html "$OUT_DIR"
cp PeacockPatcher.exe "$OUT_DIR"
cp chunk*.js "$OUT_DIR"
Expand All @@ -43,15 +43,15 @@ fi
cp LICENSE "$OUT_DIR"
cp THIRDPARTYNOTICES.txt "$OUT_DIR"
cp .nvmrc "$OUT_DIR"
mkdir "$OUT_DIR"/resources
mkdir -p "$OUT_DIR"/resources
cp resources/dynamic_resources_h3.rpkg "$OUT_DIR"/resources/dynamic_resources_h3.rpkg
cp resources/dynamic_resources_h2.rpkg "$OUT_DIR"/resources/dynamic_resources_h2.rpkg
cp resources/dynamic_resources_h1.rpkg "$OUT_DIR"/resources/dynamic_resources_h1.rpkg
cp -r resources/challenges "$OUT_DIR"/resources/challenges
cp -r resources/mastery "$OUT_DIR"/resources/mastery
cp resources/contracts.prp "$OUT_DIR"/resources/contracts.prp
mkdir "$OUT_DIR"/webui
mkdir "$OUT_DIR"/webui/dist
mkdir -p "$OUT_DIR"/webui
mkdir -p "$OUT_DIR"/webui/dist
cp webui/dist/*.html "$OUT_DIR"/webui/dist
cp -r webui/dist/assets "$OUT_DIR"/webui/dist/assets
cp webui/dist/THIRDPARTYNOTICES.txt "$OUT_DIR"/webui/dist/THIRDPARTYNOTICES.txt
Expand Down
6 changes: 6 additions & 0 deletions packaging/docker-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh

VERSION=$(jq -r '.version' package.json)
BUILD_DIR=Peacock-v"$VERSION"-linux

cp -r "$BUILD_DIR"/* /app_linux
30 changes: 30 additions & 0 deletions packaging/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/sh

mkdir -p /app

cp /app_linux/chunk0* /app
cp -r /app_linux/resources /app
cp -r /app_linux/webui /app

cd /app

if [ -z "$PUID" ] || [ -z "$PGID" ]; then
exec node chunk0.js
else
EXISTING_USER=$(getent passwd "$PUID" | cut -d: -f1)
EXISTING_GROUP=$(getent group "$PGID" | cut -d: -f1)

if [ -z "$EXISTING_USER" ]; then
adduser -u $PUID -D abc
EXISTING_USER=abc
fi

if [ -z "$EXISTING_GROUP" ]; then
groupmod -g $PGID abc
EXISTING_GROUP=abc
fi

chown $EXISTING_USER:$EXISTING_GROUP -R /app

su-exec $EXISTING_USER node chunk0.js
fi