-
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
1 parent
30d3e0b
commit 067c6b8
Showing
8 changed files
with
205 additions
and
1 deletion.
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,74 @@ | ||
name: Create and publish Docker images | ||
|
||
on: | ||
push: | ||
branches: ['production'] | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAMES: debian ubuntu | ||
TARGET_PLATFORMS: linux/amd64,linux/arm64,linux/arm/v7 | ||
|
||
jobs: | ||
build-and-push-images: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
attestations: write | ||
id-token: write | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Log in to the Container registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
with: | ||
buildkitd-flags: --allow-insecure-entitlement network --allow-insecure-entitlement security | ||
|
||
- name: Create a new builder instance | ||
run: | | ||
docker buildx create --use --name multi-arch-builder | ||
- name: Inspect builder instance | ||
run: docker buildx inspect --bootstrap | ||
|
||
- name: Extract version from build.json | ||
id: extract_version | ||
run: | | ||
VERSION=$(jq -r '.latest' build.json) | ||
echo "VERSION=${VERSION}" >> $GITHUB_ENV | ||
- name: Build and push Docker images | ||
run: | | ||
ORG_NAME=$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]') | ||
VERSION=${{ env.VERSION }} | ||
for IMAGE_NAME in ${{ env.IMAGE_NAMES }}; do | ||
echo "Building and pushing $IMAGE_NAME:$VERSION for multiple architectures" | ||
docker buildx build --platform ${{ env.TARGET_PLATFORMS }} -t ${{ env.REGISTRY }}/${ORG_NAME}/${IMAGE_NAME}:${VERSION} images/${IMAGE_NAME} --push | ||
done | ||
- name: Generate artifact attestations for Docker images | ||
run: | | ||
ORG_NAME=$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]') | ||
VERSION=${{ env.VERSION }} | ||
for IMAGE_NAME in ${{ env.IMAGE_NAMES }}; do | ||
IMAGE_TAG=${{ env.REGISTRY }}/${ORG_NAME}/${IMAGE_NAME}:${VERSION} | ||
IMAGE_DIGEST=$(docker buildx imagetools inspect ${IMAGE_TAG} --format '{{json .}}' | jq -r '.manifests[0].digest') | ||
echo $IMAGE_DIGEST > ${IMAGE_NAME}_${VERSION}_attestation.txt | ||
done | ||
- name: Upload attestations | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: image-attestations | ||
path: | | ||
$(for IMAGE_NAME in ${{ env.IMAGE_NAMES }}; do echo "${IMAGE_NAME}_${VERSION}_attestation.txt"; done) |
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 |
---|---|---|
|
@@ -128,3 +128,6 @@ dist | |
.yarn/build-state.yml | ||
.yarn/install-state.gz | ||
.pnp.* | ||
|
||
loc.docker-compose.yml | ||
data |
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 +1,35 @@ | ||
# docker | ||
<br/> | ||
<p align="center"> | ||
<a href="https://github.com/SerenityJS/docker"> | ||
<img src="https://raw.githubusercontent.com/SerenityJS/serenity/develop/public/serenityjs-banner.png" alt="Logo"> | ||
</a> | ||
<p align="center"> | ||
<strong><font size = 5.5>SerenityJS Docker</font></strong> | ||
<br/> | ||
<br/> | ||
<a href="https://github.com/SerenityJS/docker/issues">Report Bug</a> | ||
<br/> | ||
<br/> | ||
<a href="https://discord.gg/jUcC3q59zg"> | ||
<img alt="discord" src="https://img.shields.io/discord/854092607239356457?style=for-the-badge&color=%237289DA&label=Discord&logo=discord&logoColor=white"> | ||
<a/> | ||
<a href="https://github.com/SerenityJS/docker/blob/develop/LICENSE"> | ||
<img alt="License" src="https://img.shields.io/github/license/SerenityJS/docker?style=for-the-badge&label=Liscense&color=hotpink"> | ||
<a/> | ||
<a href="https://www.npmjs.com/package/@serenityjs/launcher"> | ||
<img alt="License" src="https://img.shields.io/npm/v/@serenityjs/launcher?style=for-the-badge&label=NPM&logo=npm&logoColor=white"> | ||
<a/> | ||
</p> | ||
</p> | ||
|
||
# SerenityJS Docker | ||
Here's where you'll find Docker images for SerenityJS, set up for different Linux flavors. Perfect for running locally or in production! | ||
|
||
|
||
## Quick Start | ||
```sh | ||
docker run ghcr.io/serenityjs/docker:debian -it --name serenityjs-docker -v data:/data -p 19132:19132 | ||
``` | ||
|
||
> [!NOTE] | ||
> For any questions related to SerenityJS and our docker containers head to our [discord](https://discord.gg/jUcC3q59zg). |
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,4 @@ | ||
{ | ||
"latest": "1.0.0", | ||
"versions": [] | ||
} |
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,29 @@ | ||
FROM debian:latest | ||
|
||
LABEL author="ReallyFatYoshi <github.com/ReallyFatYoshi>" | ||
LABEL org.opencontainers.image.source="https://github.com/SerenityJS/docker" | ||
LABEL org.opencontainers.image.description="SerenityJS docker image for debian." | ||
LABEL org.opencontainers.image.licenses="MIT" | ||
|
||
# Install necessary packages and clean up in one layer | ||
RUN apt-get update && \ | ||
apt-get install -y wget nodejs npm && \ | ||
apt-get clean && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
EXPOSE 19132/udp | ||
|
||
WORKDIR /root | ||
|
||
COPY entrypoint.sh . | ||
|
||
# Download SerenityJS executable and make it executable | ||
RUN wget -O serenityjs-linux "https://github.com/SerenityJS/executable/releases/latest/download/serenityjs-linux" && \ | ||
chmod +x serenityjs-linux | ||
|
||
# Create /data directory and symbolic links | ||
RUN mkdir /data && \ | ||
ln -s /data/server.properties /root/server.properties && \ | ||
ln -s /data/permissions.json /root/permissions.json | ||
|
||
ENTRYPOINT ["/bin/bash", "-c", "/root/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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/bash | ||
|
||
term_handler() { | ||
timestamp=$(date "+%m-%d-%Y %H:%M:%S") | ||
GRAY='\033[0;90m' | ||
YELLOW='\033[0;33m' | ||
NC='\033[0m' | ||
|
||
echo -e "${GRAY}<${timestamp}> ${GRAY}[Serenity] ${GRAY}[${YELLOW}Warning${GRAY}] ${RED}SIGTERM received, exiting...${NC}" | ||
exit 0 | ||
} | ||
|
||
trap 'term_handler' SIGTERM | ||
|
||
/root/serenityjs-linux & | ||
|
||
wait $! |
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,26 @@ | ||
FROM ubuntu:latest | ||
|
||
LABEL author="ReallyFatYoshi <github.com/ReallyFatYoshi>" | ||
LABEL org.opencontainers.image.source="https://github.com/SerenityJS/docker" | ||
LABEL org.opencontainers.image.description="SerenityJS docker image for ubuntu." | ||
LABEL org.opencontainers.image.licenses="MIT" | ||
|
||
RUN apt-get update | ||
RUN apt-get install -y wget nodejs npm | ||
RUN apt-get clean && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
EXPOSE 19132/udp | ||
|
||
WORKDIR /root | ||
|
||
COPY entrypoint.sh . | ||
|
||
RUN wget -O serenityjs-linux "https://github.com/SerenityJS/executable/releases/latest/download/serenityjs-linux" && \ | ||
chmod +x serenityjs-linux | ||
|
||
RUN mkdir /data\ | ||
&& ln -s /data/server.properties /root/server.properties \ | ||
&& ln -s /data/permissions.json /root/permissions.json | ||
|
||
ENTRYPOINT [ "/bin/bash", "-c", "/root/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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/bash | ||
|
||
term_handler() { | ||
timestamp=$(date "+%m-%d-%Y %H:%M:%S") | ||
GRAY='\033[0;90m' | ||
YELLOW='\033[0;33m' | ||
NC='\033[0m' | ||
|
||
echo -e "${GRAY}<${timestamp}> ${GRAY}[Serenity] ${GRAY}[${YELLOW}Warning${GRAY}] ${RED}SIGTERM received, exiting...${NC}" | ||
exit 0 | ||
} | ||
|
||
trap 'term_handler' SIGTERM | ||
|
||
/root/serenityjs-linux & | ||
|
||
wait $! |