Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
zicklag committed Nov 2, 2024
0 parents commit 809e467
Show file tree
Hide file tree
Showing 4 changed files with 150 additions and 0 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/build_and_push.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Build Docker Image

on:
push:
branches:
- main
tags:
- "v*"

env:
RELEASE_VERSION: ${{ github.ref_name }}

jobs:
build-and-publish:
name: Build and Publish Container
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
# list of Docker images to use as base name for tags
images: |
ghcr.io/katharostech/linode-cli
# generate Docker tags based on the following events/attributes
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
4 changes: 4 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM alpine:latest
RUN apk add --no-cache pipx
RUN pipx install linode-cli
ENTRYPOINT ["sh"]
24 changes: 24 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.

In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

For more information, please refer to <https://unlicense.org>
64 changes: 64 additions & 0 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#!/bin/sh

set -e

# Make sure the database exists
touch /data/ooye.db

cat << EOF > config.js
module.exports = {
discordToken: "${DISCORD_TOKEN}"
}
EOF

admin_invite_line=""
admin_invite_empty=""

if [ -n "${ADMIN_INVITE}" ]; then
admin_invite_line="- '${ADMIN_INVITE}'"
else
admin_invite_empty="[]"
fi

cat << EOF > registration.yaml
id: de8c56117637cb5d9f4ac216f612dc2adb1de4c09ae8d13553f28c33a28147c7
hs_token: ${HS_TOKEN}
as_token: ${AS_TOKEN}
url: ${URL}
sender_localpart: ${NAMESPACE_PREFIX}_bridge_bot
protocols:
- discord
namespaces:
users:
- exclusive: true
regex: '@${NAMESPACE_PREFIX}.*'
aliases:
- exclusive: true
regex: '#${NAMESPACE_PREFIX}.*'
rate_limited: false
ooye:
namespace_prefix: ${NAMESPACE_PREFIX}
max_file_size: 5000000
server_name: ${SERVER_NAME}
server_origin: ${SERVER_ORIGIN}
content_length_workaround: ${CONTENT_LENGTH_WORKAROUND}
invite: ${admin_invite_empty}
${admin_invite_line}
EOF

echo "Here is your registration YAML:"
echo ""
cat registration.yaml
echo ""

echo "Setting up / seeding database if necessary"

emoji_arg=""
if [ -n "${EMOJI_GUILD}" ]; then
emoji_arg="--emoji-guild=${EMOJI_GUILD}"
fi

node scripts/seed.js $emoji_arg

echo "Starting server"
exec node start.js

0 comments on commit 809e467

Please sign in to comment.