Skip to content
Open
Show file tree
Hide file tree
Changes from 2 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
23 changes: 11 additions & 12 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ workflows:
requires:
- test
filters:
branches:
only:
- master
branches:
only:
- master
- build_children:
context: circle-api
requires:
Expand All @@ -30,9 +30,9 @@ workflows:
requires:
- test
filters:
branches:
only:
- master
branches:
only:
- master
- build_children:
context: circle-api
requires:
Expand Down Expand Up @@ -80,8 +80,7 @@ jobs:
destination: docker-lancachenet-ubuntu.tar
- persist_to_workspace:
root: workspace
paths:
lancachenet-ubuntu.tar
paths: lancachenet-ubuntu.tar
publish_latest:
executor: testbuild-executor
steps:
Expand All @@ -100,7 +99,7 @@ jobs:
- run:
name: "Request API to build children"
command: |
for child in {"ubuntu-nginx","lancache-dns"}; do
echo "Asking API to trigger build for $child"
curl -X POST --header "Content-Type: application/json" -d '{"branch":"master"}' https://circleci.com/api/v1.1/project/github/lancachenet/$child/build?circle-token=${CIRCLE_API_USER_TOKEN}
done
for child in {"ubuntu-nginx","lancache-dns"}; do
echo "Asking API to trigger build for $child"
curl -X POST --header "Content-Type: application/json" -d '{"branch":"master"}' https://circleci.com/api/v1.1/project/github/lancachenet/$child/build?circle-token=${CIRCLE_API_USER_TOKEN}
done
14 changes: 14 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
root = true

[*]
indent_style = space
indent_size = 2
trim_trailing_whitespace = true
end_of_line = lf
insert_final_newline = true

[*.md]
indent_size = 0

[*.sh]
indent_style = tab
55 changes: 55 additions & 0 deletions .github/workflows/mega-linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# MegaLinter GitHub Action configuration file
# More info at https://megalinter.io
---
name: MegaLinter

on:
pull_request:
branches:
- master

env:
GITHUB_STATUS_REPORTER: true

concurrency:
group: ${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true

jobs:
megalinter:
name: MegaLinter
runs-on: ubuntu-latest

permissions:
contents: write
issues: write
pull-requests: write

steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
token: ${{ secrets.PAT || secrets.GITHUB_TOKEN }}
fetch-depth: 0

- name: MegaLinter
uses: oxsecurity/megalinter@v8
id: ml
env:
VALIDATE_ALL_CODEBASE: >-
${{
github.event_name == 'push' &&
github.ref == 'refs/heads/master'
}}

GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Archive production artifacts
uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: MegaLinter reports
include-hidden-files: "true"
path: |
megalinter-reports
mega-linter.log
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
reports
megalinter-reports
6 changes: 6 additions & 0 deletions .lefthook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
pre-commit:
parallel: true
jobs:
- name: megalinter
run: docker run --rm -e USER=$(id -u) -e GROUP=$(id -g) -v "$PWD:/tmp/lint" oxsecurity/megalinter:v8
stage_fixed: true
28 changes: 28 additions & 0 deletions .mega-linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Configuration file for MegaLinter
#
# See all available variables at https://megalinter.io/latest/config-file/ and in
# linters documentation

APPLY_FIXES: all
FLAVOR_SUGGESTIONS: false
PRINT_ALPACA: false
SHOW_ELAPSED_TIME: true

ENABLE:
- ACTION
- BASH
- DOCKERFILE
- EDITORCONFIG
- MARKDOWN
- YAML

DISABLE_LINTERS:
- MARKDOWN_MARKDOWNLINT
- YAML_V8R

BASH_SHELLCHECK_ARGUMENTS: "-f gcc"
EDITORCONFIG_EDITORCONFIG_CHECKER_ARGUMENTS: "-f gcc"

POST_COMMANDS:
- command: find . -user root -group root -exec chown ${USER}:${GROUP} {} \;
cwd: workspace
41 changes: 23 additions & 18 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,24 +1,29 @@
FROM ubuntu:24.04
LABEL maintainer="LanCache.Net Team <team@lancache.net>"

LABEL org.opencontainers.image.authors="LanCache.Net Team <team@lancache.net>"

ARG DEBIAN_FRONTEND=noninteractive

RUN \
apt-get -y update && apt-get -y upgrade && \
apt-get -y install supervisor curl wget bzip2 locales tzdata --no-install-recommends && \
locale-gen en_GB.utf8 && \
update-locale LANG=en_GB.utf8 && \
apt-get -y clean && \
rm -rf /var/lib/apt/lists/*
# hadolint ignore=DL3008
RUN <<EOF
apt-get -y update
apt-get -y upgrade
apt-get -y install supervisor curl wget bzip2 locales tzdata --no-install-recommends
locale-gen en_GB.utf8
update-locale LANG=en_GB.utf8
apt-get -y clean
rm -rf /var/lib/apt/lists/*
EOF

ENV \
SUPERVISORD_EXIT_ON_FATAL=1 \
LC_ALL=en_GB.UTF-8 \
LANG=en_GB.UTF-8 \
LANGUAGE=en_GB.UTF-8 \
TZ=Europe/London \
SUPERVISORD_LOGLEVEL=WARN
SUPERVISORD_EXIT_ON_FATAL=1 \
LC_ALL=en_GB.UTF-8 \
LANG=en_GB.UTF-8 \
LANGUAGE=en_GB.UTF-8 \
TZ=Europe/London \
SUPERVISORD_LOGLEVEL=WARN

COPY --link overlay/ /

COPY overlay/ /
RUN chmod -R 755 /init /hooks
ENTRYPOINT ["/bin/bash", "-e", "/init/entrypoint"]
CMD ["/init/supervisord"]
ENTRYPOINT ["/bin/bash", "-e", "/init/entrypoint.sh"]
CMD ["/init/supervisord.sh"]
4 changes: 2 additions & 2 deletions overlay/etc/apt/apt.conf.d/dpkg-options
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Dpkg::Options {
"--force-confdef";
"--force-confold";
"--force-confdef";
"--force-confold";
}
Empty file.
16 changes: 8 additions & 8 deletions overlay/hooks/entrypoint-pre.d/00_asciilogo.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/bin/bash
echo " _ _____ _ _ "
echo " | | / ____| | | | | "
echo " | | __ _ _ __ | | __ _ ___| |__ ___ _ __ ___| |_ "
echo " | | / _\` | '_ \| | / _\` |/ __| '_ \ / _ \ | '_ \ / _ \ __| "
echo " | |___| (_| | | | | |___| (_| | (__| | | | __/_| | | | __/ |_ "
echo " |______\__,_|_| |_|\_____\__,_|\___|_| |_|\___(_)_| |_|\___|\__| "
echo ""
echo ""
echo " _ _____ _ _ "
echo " | | / ____| | | | | "
echo " | | __ _ _ __ | | __ _ ___| |__ ___ _ __ ___| |_ "
echo " | | / _\` | '_ \| | / _\` |/ __| '_ \ / _ \ | '_ \ / _ \ __| "
echo " | |___| (_| | | | | |___| (_| | (__| | | | __/_| | | | __/ |_ "
echo " |______\__,_|_| |_|\_____\__,_|\___|_| |_|\___(_)_| |_|\___|\__| "
echo ""
echo ""
68 changes: 0 additions & 68 deletions overlay/init/entrypoint

This file was deleted.

67 changes: 67 additions & 0 deletions overlay/init/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#!/usr/bin/env bash

die() {
echo "ERROR: ${1}"
exit 1
}

check_depending_env() {
if [ -n "${DEPENDING_ENVIRONMENT_VARS}" ]; then
MISSING_ENVIRONMENT_VARS=()
echo -n "* Checking depending environment variables "
for e in ${DEPENDING_ENVIRONMENT_VARS}; do
if [ ! -v "${e}" ]; then
MISSING_ENVIRONMENT_VARS+=("${e}")
fi
done
if [ ${#MISSING_ENVIRONMENT_VARS[@]} -gt 0 ]; then
echo "[missing variables]"
for missing in "${MISSING_ENVIRONMENT_VARS[@]}"; do
echo " * ${missing}"
done
echo
die "Missing environment variables"
fi
echo -n "[done]"
echo
fi
}

[[ ${DOCKER_DEBUG} ]] && set -x

# Set exec-bit automatic. When adding hooks in a Dockerfile, we shoulnt also haveto think about setting +x
# in the Dockerfile for the same file. If you want to disable a hook, rename it.
chmod +x /init/setup /hooks/{entrypoint-pre.d/*,entrypoint-run,entrypoint-exec,supervisord-pre.d/*,supervisord-ready} 2>/dev/null || true

entrypoint_pre=$(find /hooks/entrypoint-pre.d/ -maxdepth 1 -type f 2>/dev/null | sort -n)
if [ "$entrypoint_pre" != "" ]; then
for hook in $entrypoint_pre; do
echo "Executing hook ${hook}"
if ! /bin/bash -c "${hook}"; then
die "hook ${hook} returned a non-zero exit status '$?'"
fi
done
fi

[[ -f "/hooks/entrypoint-pre" ]] && echo "The /hooks/entrypoint-pre hook has been replaced with /hooks/entrypoint-pre.d/*" && exit 1

[[ -f "/init/setup" ]] && /init/setup

eval "${SETUP:-}"

case ${1} in
run)
check_depending_env
[[ -f "/hooks/entrypoint-run" ]] && /hooks/entrypoint-run
if [[ -e /init/supervisord && -d /etc/supervisor ]]; then
# Use exec so we replace our current process so signals can get through
exec /bin/bash /init/supervisord
else
exec /bin/bash
fi
;;
*)
[[ -f "/hooks/entrypoint-exec" ]] && /hooks/entrypoint-exec
exec "$@"
;;
esac
Loading