Skip to content

Commit

Permalink
Initialize release
Browse files Browse the repository at this point in the history
  • Loading branch information
mrhotio committed Aug 20, 2023
0 parents commit 369f59b
Show file tree
Hide file tree
Showing 13 changed files with 1,231 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.git
.github
.gitattributes
build.sh
LICENSE
README.md
update-digests.sh
update-versions.sh
VERSION.json
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto eol=lf
378 changes: 378 additions & 0 deletions .github/workflows/build.yml

Large diffs are not rendered by default.

674 changes: 674 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Documentation

All our documentation is located at [hotio.dev](https://hotio.dev).

# Support

If you need some assistance, please join our [discord](https://hotio.dev/discord) server.

# Source

The source is hosted at [GitHub](https://github.com/hotio). If you can't find it in the `master` branch, it's probably located in another branch.

# Show your support

You can show your support by giving us a star on Docker Hub or/and GitHub, it's also possible to make a [donation](https://hotio.dev/donate).
11 changes: 11 additions & 0 deletions VERSION.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"latest": true,
"description": "Releases",
"version": "1.33.2",
"changelog": "https://github.com/sct/overseerr/compare/v1.33.1...v1.33.2",
"upstream_image": "cr.hotio.dev/hotio/base",
"upstream_tag": "alpine",
"upstream_digest_amd64": "sha256:900e4d4190ce888480b287de41d7b9f8a0c65a14bc1e739feac814ceab93dc36",
"upstream_digest_arm64": "sha256:af86b6528da8ecaf00e5cc4e5ec27ee3b42f9549c6a679252cf9220cd88aa33e",
"test_url": "http://localhost:5055"
}
10 changes: 10 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

if [[ -z ${1} ]]; then
echo "Usage: ./build.sh amd64"
echo " ./build.sh arm64"
exit 1
fi

image=$(basename "$(git rev-parse --show-toplevel)")
docker build -f "./linux-${1}.Dockerfile" -t "${image}-${1}" $(for i in $(jq -r 'to_entries[] | [(.key | ascii_upcase),.value] | join("=")' < VERSION.json); do out+="--build-arg $i " ; done; echo $out;out="") .
34 changes: 34 additions & 0 deletions linux-amd64.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
ARG UPSTREAM_IMAGE
ARG UPSTREAM_DIGEST_AMD64

FROM node:16.17-alpine AS builder
RUN apk add --no-cache curl
ARG VERSION
ENV COMMIT_TAG=${VERSION}
RUN mkdir /build && \
curl -fsSL "https://github.com/sct/overseerr/archive/v${VERSION}.tar.gz" | tar xzf - -C "/build" --strip-components=1 && \
cd /build && \
CYPRESS_INSTALL_BINARY=0 yarn --frozen-lockfile --network-timeout 1000000 && \
yarn build && \
yarn install --production --ignore-scripts --prefer-offline && \
yarn cache clean


FROM ${UPSTREAM_IMAGE}@${UPSTREAM_DIGEST_AMD64}
EXPOSE 5055
VOLUME ["${CONFIG_DIR}"]

RUN apk add --no-cache yarn

COPY --from=builder /build/dist "${APP_DIR}/dist"
COPY --from=builder /build/.next "${APP_DIR}/.next"
COPY --from=builder /build/node_modules "${APP_DIR}/node_modules"

ARG VERSION
RUN curl -fsSL "https://github.com/sct/overseerr/archive/v${VERSION}.tar.gz" | tar xzf - -C "${APP_DIR}" --strip-components=1 && \
echo '{"commitTag": "'"${VERSION}"'"}' > "${APP_DIR}/committag.json" && \
rm -rf "${APP_DIR}/config" && ln -s "${CONFIG_DIR}" "${APP_DIR}/config" && \
chmod -R u=rwX,go=rX "${APP_DIR}"

COPY root/ /
RUN chmod -R +x /etc/cont-init.d/ /etc/services.d/
34 changes: 34 additions & 0 deletions linux-arm64.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
ARG UPSTREAM_IMAGE
ARG UPSTREAM_DIGEST_ARM64

FROM node:16.17-alpine AS builder
RUN apk add --no-cache curl build-base python3 sqlite
ARG VERSION
ENV COMMIT_TAG=${VERSION}
RUN mkdir /build && \
curl -fsSL "https://github.com/sct/overseerr/archive/v${VERSION}.tar.gz" | tar xzf - -C "/build" --strip-components=1 && \
cd /build && \
CYPRESS_INSTALL_BINARY=0 yarn --frozen-lockfile --network-timeout 1000000 && \
yarn build && \
yarn install --production --ignore-scripts --prefer-offline && \
yarn cache clean


FROM ${UPSTREAM_IMAGE}@${UPSTREAM_DIGEST_ARM64}
EXPOSE 5055
VOLUME ["${CONFIG_DIR}"]

RUN apk add --no-cache yarn

COPY --from=builder /build/dist "${APP_DIR}/dist"
COPY --from=builder /build/.next "${APP_DIR}/.next"
COPY --from=builder /build/node_modules "${APP_DIR}/node_modules"

ARG VERSION
RUN curl -fsSL "https://github.com/sct/overseerr/archive/v${VERSION}.tar.gz" | tar xzf - -C "${APP_DIR}" --strip-components=1 && \
echo '{"commitTag": "'"${VERSION}"'"}' > "${APP_DIR}/committag.json" && \
rm -rf "${APP_DIR}/config" && ln -s "${CONFIG_DIR}" "${APP_DIR}/config" && \
chmod -R u=rwX,go=rX "${APP_DIR}"

COPY root/ /
RUN chmod -R +x /etc/cont-init.d/ /etc/services.d/
32 changes: 32 additions & 0 deletions root/etc/cont-init.d/00-start-container
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/command/with-contenv bash
# shellcheck shell=bash

umask "${UMASK}"

echo "
----------------------------------------------------------------------
ENVIRONMENT
----------------------------------------------------------------------
PUID=${PUID}
PGID=${PGID}
UMASK=${UMASK}
TZ=${TZ}
----------------------------------------------------------------------
"

if [[ ! "${PUID}" -eq 0 ]] && [[ ! "${PGID}" -eq 0 ]]; then
echo "Executing usermod..."
mkdir "/tmp/temphome"
usermod -d "/tmp/temphome" hotio
usermod -o -u "${PUID}" hotio
usermod -d "${CONFIG_DIR}" hotio
rm -rf "/tmp/temphome"
groupmod -o -g "${PGID}" hotio
else
echo "Running as root is not supported, please fix your PUID and PGID!"
exit 1
fi

echo "Applying permissions to ${CONFIG_DIR}"
chmod "=rwx" "${CONFIG_DIR}"
chown hotio:hotio "${CONFIG_DIR}"
9 changes: 9 additions & 0 deletions root/etc/services.d/overseerr/run
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/command/with-contenv bash
# shellcheck shell=bash

umask "${UMASK}"

HOME="${APP_DIR}" && export HOME

cd "${APP_DIR}" || exit 1
exec s6-setuidgid hotio yarn start
15 changes: 15 additions & 0 deletions update-digests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

export DOCKER_CLI_EXPERIMENTAL=enabled
version_json=$(cat ./VERSION.json)
upstream_image=$(jq -r '.upstream_image' <<< "${version_json}")
upstream_tag=$(jq -r '.upstream_tag' <<< "${version_json}")
if [[ ${upstream_image} == null || ${upstream_tag} == null ]]; then
jq '.upstream_image = "'"cr.hotio.dev/hotio/base"'" | .upstream_tag = "'"alpine"'"' <<< "${version_json}" > VERSION.json
exit 0
fi
manifest=$(skopeo inspect --raw "docker://${upstream_image}:${upstream_tag}")
[[ -z ${manifest} ]] && exit 1
upstream_digest_amd64=$(echo "${manifest}" | jq -r '.manifests[] | select (.platform.architecture == "amd64" and .platform.os == "linux").digest')
upstream_digest_arm64=$(echo "${manifest}" | jq -r '.manifests[] | select (.platform.architecture == "arm64" and .platform.os == "linux").digest')
jq '.upstream_digest_amd64 = "'"${upstream_digest_amd64}"'" | .upstream_digest_arm64 = "'"${upstream_digest_arm64}"'"' <<< "${version_json}" > VERSION.json
9 changes: 9 additions & 0 deletions update-versions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

version=$(curl -u "${GITHUB_ACTOR}:${GITHUB_TOKEN}" -fsSL "https://api.github.com/repos/sct/overseerr/tags" | jq -r .[0].name | sed s/v//g)
[[ -z ${version} ]] && exit 0
old_version=$(jq -r '.version' < VERSION.json)
changelog=$(jq -r '.changelog' < VERSION.json)
[[ "${old_version}" != "${version}" ]] && changelog="https://github.com/sct/overseerr/compare/v${old_version}...v${version}"
version_json=$(cat ./VERSION.json)
jq '.version = "'"${version}"'" | .changelog = "'"${changelog}"'"' <<< "${version_json}" > VERSION.json

0 comments on commit 369f59b

Please sign in to comment.