├── .gitignore ├── update.sh ├── .gitattributes ├── .github └── workflows │ ├── verify-templating.yml │ └── ci.yml ├── versions.json ├── apply-templates.sh ├── README.md ├── versions.sh ├── generate-stackbrew-library.sh ├── 6.1 ├── alpine3.22 │ ├── Dockerfile │ └── docker-entrypoint.sh ├── alpine3.23 │ ├── Dockerfile │ └── docker-entrypoint.sh ├── trixie │ ├── Dockerfile │ └── docker-entrypoint.sh └── bookworm │ ├── Dockerfile │ └── docker-entrypoint.sh ├── 6.0 ├── alpine3.22 │ ├── Dockerfile │ └── docker-entrypoint.sh ├── alpine3.23 │ ├── Dockerfile │ └── docker-entrypoint.sh ├── trixie │ ├── Dockerfile │ └── docker-entrypoint.sh └── bookworm │ ├── Dockerfile │ └── docker-entrypoint.sh ├── 5.1 ├── alpine3.22 │ ├── Dockerfile │ └── docker-entrypoint.sh ├── alpine3.23 │ ├── Dockerfile │ └── docker-entrypoint.sh ├── trixie │ ├── Dockerfile │ └── docker-entrypoint.sh └── bookworm │ ├── Dockerfile │ └── docker-entrypoint.sh ├── docker-entrypoint.sh ├── Dockerfile.template └── LICENSE /.gitignore: -------------------------------------------------------------------------------- 1 | .jq-template.awk 2 | -------------------------------------------------------------------------------- /update.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -Eeuo pipefail 3 | 4 | cd "$(dirname "$(readlink -f "$BASH_SOURCE")")" 5 | 6 | ./versions.sh "$@" 7 | ./apply-templates.sh "$@" 8 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | /*/**/Dockerfile linguist-generated 2 | /*/**/docker-entrypoint.sh linguist-generated 3 | /Dockerfile*.template linguist-language=Dockerfile 4 | -------------------------------------------------------------------------------- /.github/workflows/verify-templating.yml: -------------------------------------------------------------------------------- 1 | name: Verify Templating 2 | 3 | on: 4 | pull_request: 5 | push: 6 | workflow_dispatch: 7 | 8 | defaults: 9 | run: 10 | shell: 'bash -Eeuo pipefail -x {0}' 11 | 12 | jobs: 13 | apply-templates: 14 | name: Check For Uncomitted Changes 15 | runs-on: ubuntu-latest 16 | steps: 17 | - uses: actions/checkout@v4 18 | - run: ./apply-templates.sh 19 | - run: git diff --exit-code 20 | -------------------------------------------------------------------------------- /versions.json: -------------------------------------------------------------------------------- 1 | { 2 | "5.1": { 3 | "alpine": "3.23", 4 | "debian": "trixie", 5 | "downloadUrl": "https://www.redmine.org/releases/redmine-5.1.10.tar.gz", 6 | "ruby": { 7 | "version": "3.2" 8 | }, 9 | "sha256": "0f187dcca0804f42faf7bbee1ad0a759291b026f707d86347bc14f34defa6f41", 10 | "variants": [ 11 | "trixie", 12 | "bookworm", 13 | "alpine3.23", 14 | "alpine3.22" 15 | ], 16 | "version": "5.1.10" 17 | }, 18 | "6.0": { 19 | "alpine": "3.23", 20 | "debian": "trixie", 21 | "downloadUrl": "https://www.redmine.org/releases/redmine-6.0.7.tar.gz", 22 | "ruby": { 23 | "version": "3.3" 24 | }, 25 | "sha256": "8824560a07673dc7b59f1ca0bf9d7cd854c6c4c97d0fe555a5dbeba332b8dfe8", 26 | "variants": [ 27 | "trixie", 28 | "bookworm", 29 | "alpine3.23", 30 | "alpine3.22" 31 | ], 32 | "version": "6.0.7" 33 | }, 34 | "6.1": { 35 | "alpine": "3.23", 36 | "debian": "trixie", 37 | "downloadUrl": "https://www.redmine.org/releases/redmine-6.1.0.tar.gz", 38 | "ruby": { 39 | "version": "3.4" 40 | }, 41 | "sha256": "bc483da195f2444491d870e40f7fc909ae750f7ba8d0e28831e6d6c478812b88", 42 | "variants": [ 43 | "trixie", 44 | "bookworm", 45 | "alpine3.23", 46 | "alpine3.22" 47 | ], 48 | "version": "6.1.0" 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /apply-templates.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -Eeuo pipefail 3 | 4 | [ -f versions.json ] # run "versions.sh" first 5 | 6 | cd "$(dirname "$(readlink -f "$BASH_SOURCE")")" 7 | 8 | jqt='.jq-template.awk' 9 | if [ -n "${BASHBREW_SCRIPTS:-}" ]; then 10 | jqt="$BASHBREW_SCRIPTS/jq-template.awk" 11 | elif [ "$BASH_SOURCE" -nt "$jqt" ]; then 12 | # https://github.com/docker-library/bashbrew/blob/master/scripts/jq-template.awk 13 | wget -qO "$jqt" 'https://github.com/docker-library/bashbrew/raw/9f6a35772ac863a0241f147c820354e4008edf38/scripts/jq-template.awk' 14 | fi 15 | 16 | if [ "$#" -eq 0 ]; then 17 | versions="$(jq -r 'keys | map(@sh) | join(" ")' versions.json)" 18 | eval "set -- $versions" 19 | fi 20 | 21 | generated_warning() { 22 | cat <<-EOH 23 | # 24 | # NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" 25 | # 26 | # PLEASE DO NOT EDIT IT DIRECTLY. 27 | # 28 | 29 | EOH 30 | } 31 | 32 | for version; do 33 | export version 34 | 35 | if [ -d "$version" ]; then 36 | rm -rf "$version" 37 | fi 38 | 39 | if jq -e '.[env.version] | not' versions.json > /dev/null; then 40 | echo "skipping $version ..." 41 | continue 42 | fi 43 | 44 | variants="$(jq -r '.[env.version].variants | map(@sh) | join(" ")' versions.json)" 45 | eval "variants=( $variants )" 46 | 47 | for variant in "${variants[@]}"; do 48 | export variant 49 | 50 | echo "processing $version/$variant ..." 51 | 52 | dir="$version${variant:+/$variant}" 53 | 54 | mkdir -p "$dir" 55 | 56 | { 57 | generated_warning 58 | gawk -f "$jqt" Dockerfile.template 59 | } > "$dir/Dockerfile" 60 | 61 | cp -a docker-entrypoint.sh "$dir/" 62 | done 63 | done 64 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # https://github.com/docker-library/redmine 2 | 3 | ## Maintained by: [the Docker Community](https://github.com/docker-library/redmine) 4 | 5 | This is the Git repo of the [Docker "Official Image"](https://github.com/docker-library/official-images#what-are-official-images) for [`redmine`](https://hub.docker.com/_/redmine/) (not to be confused with any official `redmine` image provided by `redmine` upstream). See [the Docker Hub page](https://hub.docker.com/_/redmine/) for the full readme on how to use this Docker image and for information regarding contributing and issues. 6 | 7 | The [full image description on Docker Hub](https://hub.docker.com/_/redmine/) is generated/maintained over in [the docker-library/docs repository](https://github.com/docker-library/docs), specifically in [the `redmine` directory](https://github.com/docker-library/docs/tree/master/redmine). 8 | 9 | ## See a change merged here that doesn't show up on Docker Hub yet? 10 | 11 | For more information about the full official images change lifecycle, see [the "An image's source changed in Git, now what?" FAQ entry](https://github.com/docker-library/faq#an-images-source-changed-in-git-now-what). 12 | 13 | For outstanding `redmine` image PRs, check [PRs with the "library/redmine" label on the official-images repository](https://github.com/docker-library/official-images/labels/library%2Fredmine). For the current "source of truth" for [`redmine`](https://hub.docker.com/_/redmine/), see [the `library/redmine` file in the official-images repository](https://github.com/docker-library/official-images/blob/master/library/redmine). 14 | 15 | 16 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: GitHub CI 2 | 3 | on: 4 | pull_request: 5 | push: 6 | schedule: 7 | - cron: 0 0 * * 0 8 | 9 | defaults: 10 | run: 11 | shell: 'bash -Eeuo pipefail -x {0}' 12 | 13 | jobs: 14 | 15 | generate-jobs: 16 | name: Generate Jobs 17 | runs-on: ubuntu-latest 18 | outputs: 19 | strategy: ${{ steps.generate-jobs.outputs.strategy }} 20 | steps: 21 | - uses: actions/checkout@v4 22 | - uses: docker-library/bashbrew@HEAD 23 | - id: generate-jobs 24 | name: Generate Jobs 25 | run: | 26 | strategy="$("$BASHBREW_SCRIPTS/github-actions/generate.sh")" 27 | strategy="$("$BASHBREW_SCRIPTS/github-actions/munge-i386.sh" -c <<<"$strategy")" 28 | strategy="$(jq -c <<<"$strategy" '.matrix.include = [ .matrix.include[] | select(.name | split("-") | (.[0] | split(".")[0:2] | join(".") | tonumber >= 6.1) and ( .[1] // "" | test("bookworm.*i386")) | not) ]')" # https://github.com/docker-library/redmine/pull/393 (6.1+ deps need newer rust on other arches and just isn't worth the trouble) 29 | echo "strategy=$strategy" >> "$GITHUB_OUTPUT" 30 | jq . <<<"$strategy" # sanity check / debugging aid 31 | 32 | test: 33 | needs: generate-jobs 34 | strategy: ${{ fromJson(needs.generate-jobs.outputs.strategy) }} 35 | name: ${{ matrix.name }} 36 | runs-on: ${{ matrix.os }} 37 | steps: 38 | - uses: actions/checkout@v4 39 | - name: Prepare Environment 40 | run: ${{ matrix.runs.prepare }} 41 | - name: Pull Dependencies 42 | run: ${{ matrix.runs.pull }} 43 | - name: Build ${{ matrix.name }} 44 | run: ${{ matrix.runs.build }} 45 | - name: History ${{ matrix.name }} 46 | run: ${{ matrix.runs.history }} 47 | - name: Test ${{ matrix.name }} 48 | run: ${{ matrix.runs.test }} 49 | - name: '"docker images"' 50 | run: ${{ matrix.runs.images }} 51 | -------------------------------------------------------------------------------- /versions.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -Eeuo pipefail 3 | 4 | supportedDebianSuites=( 5 | trixie 6 | bookworm 7 | ) 8 | supportedAlpineVersions=( 9 | 3.23 10 | 3.22 11 | ) 12 | 13 | defaultDebianSuite="${supportedDebianSuites[0]}" 14 | declare -A debianSuites=( 15 | #[5.0]='bookworm' 16 | ) 17 | defaultAlpineVersion="${supportedAlpineVersions[0]}" 18 | declare -A alpineVersions=( 19 | #[5.0]='3.16' 20 | ) 21 | # see https://www.redmine.org/projects/redmine/wiki/redmineinstall 22 | defaultRubyVersion='3.4' 23 | declare -A rubyVersions=( 24 | [6.0]='3.3' 25 | [5.1]='3.2' 26 | #[5.0]='3.1' 27 | ) 28 | 29 | cd "$(dirname "$(readlink -f "$BASH_SOURCE")")" 30 | 31 | versions=( "$@" ) 32 | if [ ${#versions[@]} -eq 0 ]; then 33 | versions=( */ ) 34 | json='{}' 35 | else 36 | json="$(< versions.json)" 37 | fi 38 | versions=( "${versions[@]%/}" ) 39 | 40 | releasesUrl='https://www.redmine.org/releases' 41 | 42 | declare packages= 43 | 44 | fetch_package_list() { 45 | local -; set +x # make sure running with "set -x" doesn't spam the terminal with the raw package lists 46 | 47 | if [ -z "${packages}" ]; then 48 | packages="$(curl -fsSL "$releasesUrl")" 49 | fi 50 | } 51 | 52 | get_version() { 53 | local version="$1"; shift 54 | fetch_package_list 55 | 56 | fullVersion="$( 57 | sed <<<"$packages" \ 58 | -rne 's/.*redmine-([0-9.]+)[.]tar[.]gz.*/\1/p' \ 59 | | cut -d/ -f3 \ 60 | | cut -d^ -f1 \ 61 | | grep -e "^$version" \ 62 | | sort -urV \ 63 | | head -1 64 | )" 65 | 66 | if [ -z "$fullVersion" ]; then 67 | echo >&2 "error: failed to find full version for '$version'" 68 | exit 1 69 | fi 70 | 71 | downloadUrl="$releasesUrl/redmine-$fullVersion.tar.gz" 72 | sha256="$(curl -fsSL $downloadUrl.sha256 | awk '{print $1}')" 73 | } 74 | 75 | for version in "${versions[@]}"; do 76 | export version 77 | 78 | versionAlpineVersion="${alpineVersions[$version]:-$defaultAlpineVersion}" 79 | versionDebianSuite="${debianSuites[$version]:-$defaultDebianSuite}" 80 | versionRubyVersion="${rubyVersions[$version]:-$defaultRubyVersion}" 81 | export versionAlpineVersion versionDebianSuite versionRubyVersion 82 | 83 | doc="$(jq -nc '{ 84 | alpine: env.versionAlpineVersion, 85 | debian: env.versionDebianSuite, 86 | }')" 87 | 88 | get_version "$version" 89 | 90 | for suite in "${supportedDebianSuites[@]}"; do 91 | export suite 92 | doc="$(jq <<<"$doc" -c ' 93 | .variants += [ env.suite ] 94 | ')" 95 | done 96 | 97 | for alpineVersion in "${supportedAlpineVersions[@]}"; do 98 | doc="$(jq <<<"$doc" -c --arg v "$alpineVersion" ' 99 | .variants += [ "alpine" + $v ] 100 | ')" 101 | done 102 | 103 | echo "$version: $fullVersion" 104 | 105 | export fullVersion downloadUrl sha256 106 | json="$(jq <<<"$json" -c --argjson doc "$doc" ' 107 | .[env.version] = ($doc + { 108 | version: env.fullVersion, 109 | downloadUrl: env.downloadUrl, 110 | sha256: env.sha256, 111 | "ruby": { 112 | version: env.versionRubyVersion 113 | } 114 | }) 115 | ')" 116 | 117 | done 118 | 119 | jq <<<"$json" -S . > versions.json 120 | -------------------------------------------------------------------------------- /generate-stackbrew-library.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -Eeuo pipefail 3 | 4 | declare -A aliases=( 5 | [5.1]='5' 6 | [6.1]='6 latest' 7 | ) 8 | 9 | self="$(basename "$BASH_SOURCE")" 10 | cd "$(dirname "$(readlink -f "$BASH_SOURCE")")" 11 | 12 | if [ "$#" -eq 0 ]; then 13 | versions="$(jq -r 'keys | map(@sh) | join(" ")' versions.json)" 14 | eval "set -- $versions" 15 | fi 16 | 17 | # sort version numbers with highest first 18 | IFS=$'\n'; set -- $(sort -rV <<<"$*"); unset IFS 19 | 20 | # get the most recent commit which modified any of "$@" 21 | fileCommit() { 22 | git log -1 --format='format:%H' HEAD -- "$@" 23 | } 24 | 25 | # get the most recent commit which modified "$1/Dockerfile" or any file COPY'd from "$1/Dockerfile" 26 | dirCommit() { 27 | local dir="$1"; shift 28 | ( 29 | cd "$dir" 30 | fileCommit \ 31 | Dockerfile \ 32 | $(git show HEAD:./Dockerfile | awk ' 33 | toupper($1) == "COPY" { 34 | for (i = 2; i < NF; i++) { 35 | print $i 36 | } 37 | } 38 | ') 39 | ) 40 | } 41 | 42 | getArches() { 43 | local repo="$1"; shift 44 | local officialImagesBase="${BASHBREW_LIBRARY:-https://github.com/docker-library/official-images/raw/HEAD/library}/" 45 | 46 | local parentRepoToArchesStr 47 | parentRepoToArchesStr="$( 48 | find -name 'Dockerfile' -exec awk -v officialImagesBase="$officialImagesBase" ' 49 | toupper($1) == "FROM" && $2 !~ /^('"$repo"'|scratch|.*\/.*)(:|$)/ { 50 | printf "%s%s\n", officialImagesBase, $2 51 | } 52 | ' '{}' + \ 53 | | sort -u \ 54 | | xargs -r bashbrew cat --format '["{{ .RepoName }}:{{ .TagName }}"]="{{ join " " .TagEntry.Architectures }}"' 55 | )" 56 | eval "declare -g -A parentRepoToArches=( $parentRepoToArchesStr )" 57 | } 58 | getArches 'redmine' 59 | 60 | cat <<-EOH 61 | # this file is generated via https://github.com/docker-library/redmine/blob/$(fileCommit "$self")/$self 62 | 63 | Maintainers: Tianon Gravi (@tianon), 64 | Joseph Ferguson (@yosifkit) 65 | GitRepo: https://github.com/docker-library/redmine.git 66 | EOH 67 | 68 | # prints "$2$1$3$1...$N" 69 | join() { 70 | local sep="$1"; shift 71 | local out; printf -v out "${sep//%/%%}%s" "$@" 72 | echo "${out#$sep}" 73 | } 74 | 75 | for version; do 76 | export version 77 | 78 | variants="$(jq -r '.[env.version].variants | map(@sh) | join(" ")' versions.json)" 79 | eval "variants=( $variants )" 80 | 81 | alpine="$(jq -r '.[env.version].alpine' versions.json)" 82 | debian="$(jq -r '.[env.version].debian' versions.json)" 83 | 84 | fullVersion="$(jq -r '.[env.version].version' versions.json)" 85 | 86 | versionAliases=() 87 | while [ "$fullVersion" != "$version" -a "${fullVersion%[.]*}" != "$fullVersion" ]; do 88 | versionAliases+=( $fullVersion ) 89 | fullVersion="${fullVersion%[.]*}" 90 | done 91 | versionAliases+=( 92 | $version 93 | ${aliases[$version]:-} 94 | ) 95 | 96 | for variant in "${variants[@]}"; do 97 | dir="$version/$variant" 98 | commit="$(dirCommit "$dir")" 99 | 100 | variantParent="$(awk 'toupper($1) == "FROM" { print $2 }' "$dir/Dockerfile")" 101 | variantArches="${parentRepoToArches[$variantParent]}" 102 | 103 | if [ "$variant" = 'bookworm' ] && [ "$version" != '5.1' ] && [ "$version" != '6.0' ]; then 104 | # https://github.com/docker-library/redmine/pull/393 (6.1+ deps need newer rust on other arches and just isn't worth the trouble) 105 | variantArches="$(jq <<<"$variantArches" --raw-input --raw-output ' 106 | split(" ") 107 | | map(select(IN("amd64", "arm64v8"))) 108 | | join(" ") 109 | ')" 110 | fi 111 | if [[ "$variant" = 'alpine'* ]] && [ "$version" != '5.1' ] && [ "$version" != '6.0' ]; then 112 | # 6.1 alpine fails to build in a reasonable time on arm32v6 113 | variantArches="$(jq <<<"$variantArches" --raw-input --raw-output ' 114 | split(" ") 115 | | map(select(IN("arm32v6") | not)) 116 | | join(" ") 117 | ')" 118 | fi 119 | 120 | variantAliases=( "${versionAliases[@]/%/-$variant}" ) 121 | variantAliases=( "${variantAliases[@]//latest-/}" ) 122 | 123 | case "$variant" in 124 | "$debian") 125 | variantAliases=( 126 | "${versionAliases[@]}" 127 | "${variantAliases[@]}" 128 | ) 129 | ;; 130 | alpine"$alpine") 131 | variantAliases+=( "${versionAliases[@]/%/-alpine}" ) 132 | variantAliases=( "${variantAliases[@]//latest-/}" ) 133 | ;; 134 | esac 135 | 136 | echo 137 | cat <<-EOE 138 | Tags: $(join ', ' "${variantAliases[@]}") 139 | Architectures: $(join ', ' $variantArches) 140 | GitCommit: $commit 141 | Directory: $dir 142 | EOE 143 | done 144 | done 145 | -------------------------------------------------------------------------------- /6.1/alpine3.22/Dockerfile: -------------------------------------------------------------------------------- 1 | # 2 | # NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" 3 | # 4 | # PLEASE DO NOT EDIT IT DIRECTLY. 5 | # 6 | 7 | FROM ruby:3.4-alpine3.22 8 | 9 | # explicitly set uid/gid to guarantee that it won't change in the future 10 | # the values 999:999 are identical to the current user/group id assigned 11 | # alpine already has a gid 999, so we'll use the next id 12 | RUN addgroup -S -g 1000 redmine && adduser -S -H -G redmine -u 999 redmine 13 | 14 | RUN set -eux; \ 15 | apk add --no-cache \ 16 | bash \ 17 | breezy \ 18 | ca-certificates \ 19 | findutils \ 20 | ghostscript \ 21 | ghostscript-fonts \ 22 | git \ 23 | imagemagick \ 24 | mercurial \ 25 | openssh-client \ 26 | subversion \ 27 | tini \ 28 | tzdata \ 29 | wget \ 30 | ; 31 | 32 | # grab gosu for easy step-down from root 33 | # https://github.com/tianon/gosu/releases 34 | ENV GOSU_VERSION 1.19 35 | RUN set -eux; \ 36 | \ 37 | apk add --no-cache --virtual .gosu-deps \ 38 | dpkg \ 39 | gnupg \ 40 | ; \ 41 | \ 42 | dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')"; \ 43 | wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch"; \ 44 | wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch.asc"; \ 45 | export GNUPGHOME="$(mktemp -d)"; \ 46 | gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4; \ 47 | gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu; \ 48 | gpgconf --kill all; \ 49 | rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc; \ 50 | \ 51 | apk del --no-network .gosu-deps; \ 52 | \ 53 | # smoke test 54 | chmod +x /usr/local/bin/gosu; \ 55 | gosu --version; \ 56 | gosu nobody true 57 | 58 | ENV RAILS_ENV production 59 | WORKDIR /usr/src/redmine 60 | 61 | # https://github.com/docker-library/redmine/issues/138#issuecomment-438834176 62 | # (bundler needs this for running as an arbitrary user) 63 | ENV HOME /home/redmine 64 | RUN set -eux; \ 65 | [ ! -d "$HOME" ]; \ 66 | mkdir -p "$HOME"; \ 67 | chown redmine:redmine "$HOME"; \ 68 | chmod 1777 "$HOME" 69 | 70 | ENV REDMINE_VERSION 6.1.0 71 | ENV REDMINE_DOWNLOAD_URL https://www.redmine.org/releases/redmine-6.1.0.tar.gz 72 | ENV REDMINE_DOWNLOAD_SHA256 bc483da195f2444491d870e40f7fc909ae750f7ba8d0e28831e6d6c478812b88 73 | ENV RAILS_LOG_TO_STDOUT true 74 | 75 | RUN set -eux; \ 76 | wget -O redmine.tar.gz "$REDMINE_DOWNLOAD_URL"; \ 77 | echo "$REDMINE_DOWNLOAD_SHA256 *redmine.tar.gz" | sha256sum -c -; \ 78 | tar -xf redmine.tar.gz --strip-components=1; \ 79 | rm redmine.tar.gz files/delete.me log/delete.me; \ 80 | # https://www.redmine.org/projects/redmine/wiki/RedmineInstall#Step-8-File-system-permissions 81 | set -- 'config' 'db' 'log' 'public/assets' 'sqlite' 'tmp' 'tmp/pdf' 'tmp/pids'; \ 82 | mkdir -p "$@"; \ 83 | chown -R redmine:redmine ./; \ 84 | # fix permissions for running as an arbitrary user 85 | chmod -R ugo=rwX "$@"; \ 86 | find "$@" -type d -exec chmod 1777 '{}' + 87 | 88 | RUN set -eux; \ 89 | apk add --no-cache --virtual .build-deps \ 90 | cargo \ 91 | clang19-dev \ 92 | coreutils \ 93 | freetds-dev \ 94 | gcc \ 95 | make \ 96 | mariadb-dev \ 97 | musl-dev \ 98 | patch \ 99 | postgresql-dev \ 100 | yaml-dev \ 101 | ; \ 102 | \ 103 | gosu redmine bundle config --local without 'development test'; \ 104 | # https://github.com/redmine/redmine/commit/23dc108e70a0794f444803ac827a690085dcd557 105 | # ("gem puma" already exists in the Gemfile, but under "group :test" and we want it all the time) 106 | puma="$(grep -E "^[[:space:]]*gem [:'\"]puma['\",[:space:]].*\$" Gemfile)"; \ 107 | { echo; echo "$puma"; } | sed -re 's/^[[:space:]]+//' >> Gemfile; \ 108 | # fill up "database.yml" with bogus entries so the redmine Gemfile will pre-install all database adapter dependencies 109 | # https://github.com/redmine/redmine/blob/e9f9767089a4e3efbd73c35fc55c5c7eb85dd7d3/Gemfile#L50-L79 110 | echo '# the following entries only exist to force `bundle install` to pre-install all database adapter dependencies -- they can be safely removed/ignored' > ./config/database.yml; \ 111 | for adapter in mysql2 postgresql sqlserver sqlite3; do \ 112 | echo "$adapter:" >> ./config/database.yml; \ 113 | echo " adapter: $adapter" >> ./config/database.yml; \ 114 | done; \ 115 | gosu redmine bundle install --jobs "$(nproc)"; \ 116 | rm ./config/database.yml; \ 117 | # fix permissions for running as an arbitrary user 118 | chmod -R ugo=rwX Gemfile.lock "$GEM_HOME"; \ 119 | rm -rf ~redmine/.bundle; \ 120 | \ 121 | # https://github.com/naitoh/rbpdf/issues/31 122 | rm /usr/local/bundle/gems/rbpdf-font-1.19.*/lib/fonts/ttf2ufm/ttf2ufm; \ 123 | \ 124 | runDeps="$( \ 125 | scanelf --needed --nobanner --format '%n#p' --recursive /usr/local/bundle/gems \ 126 | | tr ',' '\n' \ 127 | | sort -u \ 128 | | awk ' \ 129 | $1 == "libc.so" { next } \ 130 | system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } \ 131 | { print "so:" $1 } \ 132 | ' \ 133 | )"; \ 134 | apk add --no-network --virtual .redmine-rundeps $runDeps; \ 135 | apk del --no-network .build-deps 136 | 137 | VOLUME /usr/src/redmine/files 138 | 139 | COPY docker-entrypoint.sh / 140 | ENTRYPOINT ["/docker-entrypoint.sh"] 141 | 142 | EXPOSE 3000 143 | CMD ["rails", "server", "-b", "0.0.0.0"] 144 | -------------------------------------------------------------------------------- /6.1/alpine3.23/Dockerfile: -------------------------------------------------------------------------------- 1 | # 2 | # NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" 3 | # 4 | # PLEASE DO NOT EDIT IT DIRECTLY. 5 | # 6 | 7 | FROM ruby:3.4-alpine3.23 8 | 9 | # explicitly set uid/gid to guarantee that it won't change in the future 10 | # the values 999:999 are identical to the current user/group id assigned 11 | # alpine already has a gid 999, so we'll use the next id 12 | RUN addgroup -S -g 1000 redmine && adduser -S -H -G redmine -u 999 redmine 13 | 14 | RUN set -eux; \ 15 | apk add --no-cache \ 16 | bash \ 17 | breezy \ 18 | ca-certificates \ 19 | findutils \ 20 | ghostscript \ 21 | ghostscript-fonts \ 22 | git \ 23 | imagemagick \ 24 | mercurial \ 25 | openssh-client \ 26 | subversion \ 27 | tini \ 28 | tzdata \ 29 | wget \ 30 | ; 31 | 32 | # grab gosu for easy step-down from root 33 | # https://github.com/tianon/gosu/releases 34 | ENV GOSU_VERSION 1.19 35 | RUN set -eux; \ 36 | \ 37 | apk add --no-cache --virtual .gosu-deps \ 38 | dpkg \ 39 | gnupg \ 40 | ; \ 41 | \ 42 | dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')"; \ 43 | wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch"; \ 44 | wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch.asc"; \ 45 | export GNUPGHOME="$(mktemp -d)"; \ 46 | gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4; \ 47 | gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu; \ 48 | gpgconf --kill all; \ 49 | rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc; \ 50 | \ 51 | apk del --no-network .gosu-deps; \ 52 | \ 53 | # smoke test 54 | chmod +x /usr/local/bin/gosu; \ 55 | gosu --version; \ 56 | gosu nobody true 57 | 58 | ENV RAILS_ENV production 59 | WORKDIR /usr/src/redmine 60 | 61 | # https://github.com/docker-library/redmine/issues/138#issuecomment-438834176 62 | # (bundler needs this for running as an arbitrary user) 63 | ENV HOME /home/redmine 64 | RUN set -eux; \ 65 | [ ! -d "$HOME" ]; \ 66 | mkdir -p "$HOME"; \ 67 | chown redmine:redmine "$HOME"; \ 68 | chmod 1777 "$HOME" 69 | 70 | ENV REDMINE_VERSION 6.1.0 71 | ENV REDMINE_DOWNLOAD_URL https://www.redmine.org/releases/redmine-6.1.0.tar.gz 72 | ENV REDMINE_DOWNLOAD_SHA256 bc483da195f2444491d870e40f7fc909ae750f7ba8d0e28831e6d6c478812b88 73 | ENV RAILS_LOG_TO_STDOUT true 74 | 75 | RUN set -eux; \ 76 | wget -O redmine.tar.gz "$REDMINE_DOWNLOAD_URL"; \ 77 | echo "$REDMINE_DOWNLOAD_SHA256 *redmine.tar.gz" | sha256sum -c -; \ 78 | tar -xf redmine.tar.gz --strip-components=1; \ 79 | rm redmine.tar.gz files/delete.me log/delete.me; \ 80 | # https://www.redmine.org/projects/redmine/wiki/RedmineInstall#Step-8-File-system-permissions 81 | set -- 'config' 'db' 'log' 'public/assets' 'sqlite' 'tmp' 'tmp/pdf' 'tmp/pids'; \ 82 | mkdir -p "$@"; \ 83 | chown -R redmine:redmine ./; \ 84 | # fix permissions for running as an arbitrary user 85 | chmod -R ugo=rwX "$@"; \ 86 | find "$@" -type d -exec chmod 1777 '{}' + 87 | 88 | RUN set -eux; \ 89 | apk add --no-cache --virtual .build-deps \ 90 | cargo \ 91 | clang19-dev \ 92 | coreutils \ 93 | freetds-dev \ 94 | gcc \ 95 | make \ 96 | mariadb-dev \ 97 | musl-dev \ 98 | patch \ 99 | postgresql-dev \ 100 | yaml-dev \ 101 | ; \ 102 | \ 103 | gosu redmine bundle config --local without 'development test'; \ 104 | # https://github.com/redmine/redmine/commit/23dc108e70a0794f444803ac827a690085dcd557 105 | # ("gem puma" already exists in the Gemfile, but under "group :test" and we want it all the time) 106 | puma="$(grep -E "^[[:space:]]*gem [:'\"]puma['\",[:space:]].*\$" Gemfile)"; \ 107 | { echo; echo "$puma"; } | sed -re 's/^[[:space:]]+//' >> Gemfile; \ 108 | # fill up "database.yml" with bogus entries so the redmine Gemfile will pre-install all database adapter dependencies 109 | # https://github.com/redmine/redmine/blob/e9f9767089a4e3efbd73c35fc55c5c7eb85dd7d3/Gemfile#L50-L79 110 | echo '# the following entries only exist to force `bundle install` to pre-install all database adapter dependencies -- they can be safely removed/ignored' > ./config/database.yml; \ 111 | for adapter in mysql2 postgresql sqlserver sqlite3; do \ 112 | echo "$adapter:" >> ./config/database.yml; \ 113 | echo " adapter: $adapter" >> ./config/database.yml; \ 114 | done; \ 115 | gosu redmine bundle install --jobs "$(nproc)"; \ 116 | rm ./config/database.yml; \ 117 | # fix permissions for running as an arbitrary user 118 | chmod -R ugo=rwX Gemfile.lock "$GEM_HOME"; \ 119 | rm -rf ~redmine/.bundle; \ 120 | \ 121 | # https://github.com/naitoh/rbpdf/issues/31 122 | rm /usr/local/bundle/gems/rbpdf-font-1.19.*/lib/fonts/ttf2ufm/ttf2ufm; \ 123 | \ 124 | runDeps="$( \ 125 | scanelf --needed --nobanner --format '%n#p' --recursive /usr/local/bundle/gems \ 126 | | tr ',' '\n' \ 127 | | sort -u \ 128 | | awk ' \ 129 | $1 == "libc.so" { next } \ 130 | system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } \ 131 | { print "so:" $1 } \ 132 | ' \ 133 | )"; \ 134 | apk add --no-network --virtual .redmine-rundeps $runDeps; \ 135 | apk del --no-network .build-deps 136 | 137 | VOLUME /usr/src/redmine/files 138 | 139 | COPY docker-entrypoint.sh / 140 | ENTRYPOINT ["/docker-entrypoint.sh"] 141 | 142 | EXPOSE 3000 143 | CMD ["rails", "server", "-b", "0.0.0.0"] 144 | -------------------------------------------------------------------------------- /6.0/alpine3.22/Dockerfile: -------------------------------------------------------------------------------- 1 | # 2 | # NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" 3 | # 4 | # PLEASE DO NOT EDIT IT DIRECTLY. 5 | # 6 | 7 | FROM ruby:3.3-alpine3.22 8 | 9 | # explicitly set uid/gid to guarantee that it won't change in the future 10 | # the values 999:999 are identical to the current user/group id assigned 11 | # alpine already has a gid 999, so we'll use the next id 12 | RUN addgroup -S -g 1000 redmine && adduser -S -H -G redmine -u 999 redmine 13 | 14 | RUN set -eux; \ 15 | apk add --no-cache \ 16 | bash \ 17 | breezy \ 18 | ca-certificates \ 19 | findutils \ 20 | ghostscript \ 21 | ghostscript-fonts \ 22 | git \ 23 | imagemagick \ 24 | mercurial \ 25 | openssh-client \ 26 | subversion \ 27 | tini \ 28 | tzdata \ 29 | wget \ 30 | ; 31 | 32 | # grab gosu for easy step-down from root 33 | # https://github.com/tianon/gosu/releases 34 | ENV GOSU_VERSION 1.19 35 | RUN set -eux; \ 36 | \ 37 | apk add --no-cache --virtual .gosu-deps \ 38 | dpkg \ 39 | gnupg \ 40 | ; \ 41 | \ 42 | dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')"; \ 43 | wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch"; \ 44 | wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch.asc"; \ 45 | export GNUPGHOME="$(mktemp -d)"; \ 46 | gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4; \ 47 | gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu; \ 48 | gpgconf --kill all; \ 49 | rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc; \ 50 | \ 51 | apk del --no-network .gosu-deps; \ 52 | \ 53 | # smoke test 54 | chmod +x /usr/local/bin/gosu; \ 55 | gosu --version; \ 56 | gosu nobody true 57 | 58 | ENV RAILS_ENV production 59 | WORKDIR /usr/src/redmine 60 | 61 | # https://github.com/docker-library/redmine/issues/138#issuecomment-438834176 62 | # (bundler needs this for running as an arbitrary user) 63 | ENV HOME /home/redmine 64 | RUN set -eux; \ 65 | [ ! -d "$HOME" ]; \ 66 | mkdir -p "$HOME"; \ 67 | chown redmine:redmine "$HOME"; \ 68 | chmod 1777 "$HOME" 69 | 70 | ENV REDMINE_VERSION 6.0.7 71 | ENV REDMINE_DOWNLOAD_URL https://www.redmine.org/releases/redmine-6.0.7.tar.gz 72 | ENV REDMINE_DOWNLOAD_SHA256 8824560a07673dc7b59f1ca0bf9d7cd854c6c4c97d0fe555a5dbeba332b8dfe8 73 | ENV RAILS_LOG_TO_STDOUT true 74 | 75 | RUN set -eux; \ 76 | wget -O redmine.tar.gz "$REDMINE_DOWNLOAD_URL"; \ 77 | echo "$REDMINE_DOWNLOAD_SHA256 *redmine.tar.gz" | sha256sum -c -; \ 78 | tar -xf redmine.tar.gz --strip-components=1; \ 79 | rm redmine.tar.gz files/delete.me log/delete.me; \ 80 | # https://www.redmine.org/projects/redmine/wiki/RedmineInstall#Step-8-File-system-permissions 81 | set -- 'config' 'db' 'log' 'public/assets' 'sqlite' 'tmp' 'tmp/pdf' 'tmp/pids'; \ 82 | mkdir -p "$@"; \ 83 | chown -R redmine:redmine ./; \ 84 | # fix permissions for running as an arbitrary user 85 | chmod -R ugo=rwX "$@"; \ 86 | find "$@" -type d -exec chmod 1777 '{}' + 87 | 88 | # build for musl-libc, not glibc (see https://github.com/sparklemotion/nokogiri/issues/2075, https://github.com/rubygems/rubygems/issues/3174) 89 | ENV BUNDLE_FORCE_RUBY_PLATFORM 1 90 | RUN set -eux; \ 91 | apk add --no-cache --virtual .build-deps \ 92 | coreutils \ 93 | freetds-dev \ 94 | gcc \ 95 | make \ 96 | mariadb-dev \ 97 | musl-dev \ 98 | patch \ 99 | postgresql-dev \ 100 | sqlite-dev \ 101 | ttf2ufm \ 102 | yaml-dev \ 103 | zlib-dev \ 104 | ; \ 105 | \ 106 | gosu redmine bundle config --local without 'development test'; \ 107 | # https://github.com/redmine/redmine/commit/23dc108e70a0794f444803ac827a690085dcd557 108 | # ("gem puma" already exists in the Gemfile, but under "group :test" and we want it all the time) 109 | puma="$(grep -E "^[[:space:]]*gem [:'\"]puma['\",[:space:]].*\$" Gemfile)"; \ 110 | { echo; echo "$puma"; } | sed -re 's/^[[:space:]]+//' >> Gemfile; \ 111 | # fill up "database.yml" with bogus entries so the redmine Gemfile will pre-install all database adapter dependencies 112 | # https://github.com/redmine/redmine/blob/e9f9767089a4e3efbd73c35fc55c5c7eb85dd7d3/Gemfile#L50-L79 113 | echo '# the following entries only exist to force `bundle install` to pre-install all database adapter dependencies -- they can be safely removed/ignored' > ./config/database.yml; \ 114 | for adapter in mysql2 postgresql sqlserver sqlite3; do \ 115 | echo "$adapter:" >> ./config/database.yml; \ 116 | echo " adapter: $adapter" >> ./config/database.yml; \ 117 | done; \ 118 | gosu redmine bundle install --jobs "$(nproc)"; \ 119 | rm ./config/database.yml; \ 120 | # fix permissions for running as an arbitrary user 121 | chmod -R ugo=rwX Gemfile.lock "$GEM_HOME"; \ 122 | rm -rf ~redmine/.bundle; \ 123 | \ 124 | # https://github.com/naitoh/rbpdf/issues/31 125 | rm /usr/local/bundle/gems/rbpdf-font-1.19.*/lib/fonts/ttf2ufm/ttf2ufm; \ 126 | \ 127 | runDeps="$( \ 128 | scanelf --needed --nobanner --format '%n#p' --recursive /usr/local/bundle/gems \ 129 | | tr ',' '\n' \ 130 | | sort -u \ 131 | | awk ' \ 132 | system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } \ 133 | { print "so:" $1 } \ 134 | ' \ 135 | )"; \ 136 | apk add --no-network --virtual .redmine-rundeps $runDeps; \ 137 | apk del --no-network .build-deps 138 | 139 | VOLUME /usr/src/redmine/files 140 | 141 | COPY docker-entrypoint.sh / 142 | ENTRYPOINT ["/docker-entrypoint.sh"] 143 | 144 | EXPOSE 3000 145 | CMD ["rails", "server", "-b", "0.0.0.0"] 146 | -------------------------------------------------------------------------------- /6.0/alpine3.23/Dockerfile: -------------------------------------------------------------------------------- 1 | # 2 | # NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" 3 | # 4 | # PLEASE DO NOT EDIT IT DIRECTLY. 5 | # 6 | 7 | FROM ruby:3.3-alpine3.23 8 | 9 | # explicitly set uid/gid to guarantee that it won't change in the future 10 | # the values 999:999 are identical to the current user/group id assigned 11 | # alpine already has a gid 999, so we'll use the next id 12 | RUN addgroup -S -g 1000 redmine && adduser -S -H -G redmine -u 999 redmine 13 | 14 | RUN set -eux; \ 15 | apk add --no-cache \ 16 | bash \ 17 | breezy \ 18 | ca-certificates \ 19 | findutils \ 20 | ghostscript \ 21 | ghostscript-fonts \ 22 | git \ 23 | imagemagick \ 24 | mercurial \ 25 | openssh-client \ 26 | subversion \ 27 | tini \ 28 | tzdata \ 29 | wget \ 30 | ; 31 | 32 | # grab gosu for easy step-down from root 33 | # https://github.com/tianon/gosu/releases 34 | ENV GOSU_VERSION 1.19 35 | RUN set -eux; \ 36 | \ 37 | apk add --no-cache --virtual .gosu-deps \ 38 | dpkg \ 39 | gnupg \ 40 | ; \ 41 | \ 42 | dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')"; \ 43 | wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch"; \ 44 | wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch.asc"; \ 45 | export GNUPGHOME="$(mktemp -d)"; \ 46 | gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4; \ 47 | gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu; \ 48 | gpgconf --kill all; \ 49 | rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc; \ 50 | \ 51 | apk del --no-network .gosu-deps; \ 52 | \ 53 | # smoke test 54 | chmod +x /usr/local/bin/gosu; \ 55 | gosu --version; \ 56 | gosu nobody true 57 | 58 | ENV RAILS_ENV production 59 | WORKDIR /usr/src/redmine 60 | 61 | # https://github.com/docker-library/redmine/issues/138#issuecomment-438834176 62 | # (bundler needs this for running as an arbitrary user) 63 | ENV HOME /home/redmine 64 | RUN set -eux; \ 65 | [ ! -d "$HOME" ]; \ 66 | mkdir -p "$HOME"; \ 67 | chown redmine:redmine "$HOME"; \ 68 | chmod 1777 "$HOME" 69 | 70 | ENV REDMINE_VERSION 6.0.7 71 | ENV REDMINE_DOWNLOAD_URL https://www.redmine.org/releases/redmine-6.0.7.tar.gz 72 | ENV REDMINE_DOWNLOAD_SHA256 8824560a07673dc7b59f1ca0bf9d7cd854c6c4c97d0fe555a5dbeba332b8dfe8 73 | ENV RAILS_LOG_TO_STDOUT true 74 | 75 | RUN set -eux; \ 76 | wget -O redmine.tar.gz "$REDMINE_DOWNLOAD_URL"; \ 77 | echo "$REDMINE_DOWNLOAD_SHA256 *redmine.tar.gz" | sha256sum -c -; \ 78 | tar -xf redmine.tar.gz --strip-components=1; \ 79 | rm redmine.tar.gz files/delete.me log/delete.me; \ 80 | # https://www.redmine.org/projects/redmine/wiki/RedmineInstall#Step-8-File-system-permissions 81 | set -- 'config' 'db' 'log' 'public/assets' 'sqlite' 'tmp' 'tmp/pdf' 'tmp/pids'; \ 82 | mkdir -p "$@"; \ 83 | chown -R redmine:redmine ./; \ 84 | # fix permissions for running as an arbitrary user 85 | chmod -R ugo=rwX "$@"; \ 86 | find "$@" -type d -exec chmod 1777 '{}' + 87 | 88 | # build for musl-libc, not glibc (see https://github.com/sparklemotion/nokogiri/issues/2075, https://github.com/rubygems/rubygems/issues/3174) 89 | ENV BUNDLE_FORCE_RUBY_PLATFORM 1 90 | RUN set -eux; \ 91 | apk add --no-cache --virtual .build-deps \ 92 | coreutils \ 93 | freetds-dev \ 94 | gcc \ 95 | make \ 96 | mariadb-dev \ 97 | musl-dev \ 98 | patch \ 99 | postgresql-dev \ 100 | sqlite-dev \ 101 | ttf2ufm \ 102 | yaml-dev \ 103 | zlib-dev \ 104 | ; \ 105 | \ 106 | gosu redmine bundle config --local without 'development test'; \ 107 | # https://github.com/redmine/redmine/commit/23dc108e70a0794f444803ac827a690085dcd557 108 | # ("gem puma" already exists in the Gemfile, but under "group :test" and we want it all the time) 109 | puma="$(grep -E "^[[:space:]]*gem [:'\"]puma['\",[:space:]].*\$" Gemfile)"; \ 110 | { echo; echo "$puma"; } | sed -re 's/^[[:space:]]+//' >> Gemfile; \ 111 | # fill up "database.yml" with bogus entries so the redmine Gemfile will pre-install all database adapter dependencies 112 | # https://github.com/redmine/redmine/blob/e9f9767089a4e3efbd73c35fc55c5c7eb85dd7d3/Gemfile#L50-L79 113 | echo '# the following entries only exist to force `bundle install` to pre-install all database adapter dependencies -- they can be safely removed/ignored' > ./config/database.yml; \ 114 | for adapter in mysql2 postgresql sqlserver sqlite3; do \ 115 | echo "$adapter:" >> ./config/database.yml; \ 116 | echo " adapter: $adapter" >> ./config/database.yml; \ 117 | done; \ 118 | gosu redmine bundle install --jobs "$(nproc)"; \ 119 | rm ./config/database.yml; \ 120 | # fix permissions for running as an arbitrary user 121 | chmod -R ugo=rwX Gemfile.lock "$GEM_HOME"; \ 122 | rm -rf ~redmine/.bundle; \ 123 | \ 124 | # https://github.com/naitoh/rbpdf/issues/31 125 | rm /usr/local/bundle/gems/rbpdf-font-1.19.*/lib/fonts/ttf2ufm/ttf2ufm; \ 126 | \ 127 | runDeps="$( \ 128 | scanelf --needed --nobanner --format '%n#p' --recursive /usr/local/bundle/gems \ 129 | | tr ',' '\n' \ 130 | | sort -u \ 131 | | awk ' \ 132 | system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } \ 133 | { print "so:" $1 } \ 134 | ' \ 135 | )"; \ 136 | apk add --no-network --virtual .redmine-rundeps $runDeps; \ 137 | apk del --no-network .build-deps 138 | 139 | VOLUME /usr/src/redmine/files 140 | 141 | COPY docker-entrypoint.sh / 142 | ENTRYPOINT ["/docker-entrypoint.sh"] 143 | 144 | EXPOSE 3000 145 | CMD ["rails", "server", "-b", "0.0.0.0"] 146 | -------------------------------------------------------------------------------- /5.1/alpine3.22/Dockerfile: -------------------------------------------------------------------------------- 1 | # 2 | # NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" 3 | # 4 | # PLEASE DO NOT EDIT IT DIRECTLY. 5 | # 6 | 7 | FROM ruby:3.2-alpine3.22 8 | 9 | # explicitly set uid/gid to guarantee that it won't change in the future 10 | # the values 999:999 are identical to the current user/group id assigned 11 | # alpine already has a gid 999, so we'll use the next id 12 | RUN addgroup -S -g 1000 redmine && adduser -S -H -G redmine -u 999 redmine 13 | 14 | RUN set -eux; \ 15 | apk add --no-cache \ 16 | bash \ 17 | breezy \ 18 | ca-certificates \ 19 | findutils \ 20 | ghostscript \ 21 | ghostscript-fonts \ 22 | git \ 23 | imagemagick \ 24 | mercurial \ 25 | openssh-client \ 26 | subversion \ 27 | tini \ 28 | tzdata \ 29 | wget \ 30 | ; 31 | 32 | # grab gosu for easy step-down from root 33 | # https://github.com/tianon/gosu/releases 34 | ENV GOSU_VERSION 1.19 35 | RUN set -eux; \ 36 | \ 37 | apk add --no-cache --virtual .gosu-deps \ 38 | dpkg \ 39 | gnupg \ 40 | ; \ 41 | \ 42 | dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')"; \ 43 | wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch"; \ 44 | wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch.asc"; \ 45 | export GNUPGHOME="$(mktemp -d)"; \ 46 | gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4; \ 47 | gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu; \ 48 | gpgconf --kill all; \ 49 | rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc; \ 50 | \ 51 | apk del --no-network .gosu-deps; \ 52 | \ 53 | # smoke test 54 | chmod +x /usr/local/bin/gosu; \ 55 | gosu --version; \ 56 | gosu nobody true 57 | RUN set -eux; ln -svf gosu /usr/local/bin/su-exec; su-exec nobody true # backwards compatibility (removed in Redmine 5.2+) 58 | 59 | ENV RAILS_ENV production 60 | WORKDIR /usr/src/redmine 61 | 62 | # https://github.com/docker-library/redmine/issues/138#issuecomment-438834176 63 | # (bundler needs this for running as an arbitrary user) 64 | ENV HOME /home/redmine 65 | RUN set -eux; \ 66 | [ ! -d "$HOME" ]; \ 67 | mkdir -p "$HOME"; \ 68 | chown redmine:redmine "$HOME"; \ 69 | chmod 1777 "$HOME" 70 | 71 | ENV REDMINE_VERSION 5.1.10 72 | ENV REDMINE_DOWNLOAD_URL https://www.redmine.org/releases/redmine-5.1.10.tar.gz 73 | ENV REDMINE_DOWNLOAD_SHA256 0f187dcca0804f42faf7bbee1ad0a759291b026f707d86347bc14f34defa6f41 74 | ENV RAILS_LOG_TO_STDOUT true 75 | 76 | RUN set -eux; \ 77 | wget -O redmine.tar.gz "$REDMINE_DOWNLOAD_URL"; \ 78 | echo "$REDMINE_DOWNLOAD_SHA256 *redmine.tar.gz" | sha256sum -c -; \ 79 | tar -xf redmine.tar.gz --strip-components=1; \ 80 | rm redmine.tar.gz files/delete.me log/delete.me; \ 81 | # https://www.redmine.org/projects/redmine/wiki/RedmineInstall#Step-8-File-system-permissions 82 | set -- 'config' 'db' 'log' 'public/plugin_assets' 'sqlite' 'tmp' 'tmp/pdf' 'tmp/pids'; \ 83 | mkdir -p "$@"; \ 84 | chown -R redmine:redmine ./; \ 85 | # fix permissions for running as an arbitrary user 86 | chmod -R ugo=rwX "$@"; \ 87 | find "$@" -type d -exec chmod 1777 '{}' + 88 | 89 | # build for musl-libc, not glibc (see https://github.com/sparklemotion/nokogiri/issues/2075, https://github.com/rubygems/rubygems/issues/3174) 90 | ENV BUNDLE_FORCE_RUBY_PLATFORM 1 91 | RUN set -eux; \ 92 | apk add --no-cache --virtual .build-deps \ 93 | coreutils \ 94 | freetds-dev \ 95 | gcc \ 96 | make \ 97 | mariadb-dev \ 98 | musl-dev \ 99 | patch \ 100 | postgresql-dev \ 101 | sqlite-dev \ 102 | ttf2ufm \ 103 | yaml-dev \ 104 | zlib-dev \ 105 | ; \ 106 | \ 107 | gosu redmine bundle config --local without 'development test'; \ 108 | # https://github.com/redmine/redmine/commit/23dc108e70a0794f444803ac827a690085dcd557 109 | # ("gem puma" already exists in the Gemfile, but under "group :test" and we want it all the time) 110 | puma="$(grep -E "^[[:space:]]*gem [:'\"]puma['\",[:space:]].*\$" Gemfile)"; \ 111 | { echo; echo "$puma"; } | sed -re 's/^[[:space:]]+//' >> Gemfile; \ 112 | # fill up "database.yml" with bogus entries so the redmine Gemfile will pre-install all database adapter dependencies 113 | # https://github.com/redmine/redmine/blob/e9f9767089a4e3efbd73c35fc55c5c7eb85dd7d3/Gemfile#L50-L79 114 | echo '# the following entries only exist to force `bundle install` to pre-install all database adapter dependencies -- they can be safely removed/ignored' > ./config/database.yml; \ 115 | for adapter in mysql2 postgresql sqlserver sqlite3; do \ 116 | echo "$adapter:" >> ./config/database.yml; \ 117 | echo " adapter: $adapter" >> ./config/database.yml; \ 118 | done; \ 119 | gosu redmine bundle install --jobs "$(nproc)"; \ 120 | rm ./config/database.yml; \ 121 | # fix permissions for running as an arbitrary user 122 | chmod -R ugo=rwX Gemfile.lock "$GEM_HOME"; \ 123 | rm -rf ~redmine/.bundle; \ 124 | \ 125 | # https://github.com/naitoh/rbpdf/issues/31 126 | rm /usr/local/bundle/gems/rbpdf-font-1.19.*/lib/fonts/ttf2ufm/ttf2ufm; \ 127 | \ 128 | runDeps="$( \ 129 | scanelf --needed --nobanner --format '%n#p' --recursive /usr/local/bundle/gems \ 130 | | tr ',' '\n' \ 131 | | sort -u \ 132 | | awk ' \ 133 | system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } \ 134 | { print "so:" $1 } \ 135 | ' \ 136 | )"; \ 137 | apk add --no-network --virtual .redmine-rundeps $runDeps; \ 138 | apk del --no-network .build-deps 139 | 140 | VOLUME /usr/src/redmine/files 141 | 142 | COPY docker-entrypoint.sh / 143 | ENTRYPOINT ["/docker-entrypoint.sh"] 144 | 145 | EXPOSE 3000 146 | CMD ["rails", "server", "-b", "0.0.0.0"] 147 | -------------------------------------------------------------------------------- /5.1/alpine3.23/Dockerfile: -------------------------------------------------------------------------------- 1 | # 2 | # NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" 3 | # 4 | # PLEASE DO NOT EDIT IT DIRECTLY. 5 | # 6 | 7 | FROM ruby:3.2-alpine3.23 8 | 9 | # explicitly set uid/gid to guarantee that it won't change in the future 10 | # the values 999:999 are identical to the current user/group id assigned 11 | # alpine already has a gid 999, so we'll use the next id 12 | RUN addgroup -S -g 1000 redmine && adduser -S -H -G redmine -u 999 redmine 13 | 14 | RUN set -eux; \ 15 | apk add --no-cache \ 16 | bash \ 17 | breezy \ 18 | ca-certificates \ 19 | findutils \ 20 | ghostscript \ 21 | ghostscript-fonts \ 22 | git \ 23 | imagemagick \ 24 | mercurial \ 25 | openssh-client \ 26 | subversion \ 27 | tini \ 28 | tzdata \ 29 | wget \ 30 | ; 31 | 32 | # grab gosu for easy step-down from root 33 | # https://github.com/tianon/gosu/releases 34 | ENV GOSU_VERSION 1.19 35 | RUN set -eux; \ 36 | \ 37 | apk add --no-cache --virtual .gosu-deps \ 38 | dpkg \ 39 | gnupg \ 40 | ; \ 41 | \ 42 | dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')"; \ 43 | wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch"; \ 44 | wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch.asc"; \ 45 | export GNUPGHOME="$(mktemp -d)"; \ 46 | gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4; \ 47 | gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu; \ 48 | gpgconf --kill all; \ 49 | rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc; \ 50 | \ 51 | apk del --no-network .gosu-deps; \ 52 | \ 53 | # smoke test 54 | chmod +x /usr/local/bin/gosu; \ 55 | gosu --version; \ 56 | gosu nobody true 57 | RUN set -eux; ln -svf gosu /usr/local/bin/su-exec; su-exec nobody true # backwards compatibility (removed in Redmine 5.2+) 58 | 59 | ENV RAILS_ENV production 60 | WORKDIR /usr/src/redmine 61 | 62 | # https://github.com/docker-library/redmine/issues/138#issuecomment-438834176 63 | # (bundler needs this for running as an arbitrary user) 64 | ENV HOME /home/redmine 65 | RUN set -eux; \ 66 | [ ! -d "$HOME" ]; \ 67 | mkdir -p "$HOME"; \ 68 | chown redmine:redmine "$HOME"; \ 69 | chmod 1777 "$HOME" 70 | 71 | ENV REDMINE_VERSION 5.1.10 72 | ENV REDMINE_DOWNLOAD_URL https://www.redmine.org/releases/redmine-5.1.10.tar.gz 73 | ENV REDMINE_DOWNLOAD_SHA256 0f187dcca0804f42faf7bbee1ad0a759291b026f707d86347bc14f34defa6f41 74 | ENV RAILS_LOG_TO_STDOUT true 75 | 76 | RUN set -eux; \ 77 | wget -O redmine.tar.gz "$REDMINE_DOWNLOAD_URL"; \ 78 | echo "$REDMINE_DOWNLOAD_SHA256 *redmine.tar.gz" | sha256sum -c -; \ 79 | tar -xf redmine.tar.gz --strip-components=1; \ 80 | rm redmine.tar.gz files/delete.me log/delete.me; \ 81 | # https://www.redmine.org/projects/redmine/wiki/RedmineInstall#Step-8-File-system-permissions 82 | set -- 'config' 'db' 'log' 'public/plugin_assets' 'sqlite' 'tmp' 'tmp/pdf' 'tmp/pids'; \ 83 | mkdir -p "$@"; \ 84 | chown -R redmine:redmine ./; \ 85 | # fix permissions for running as an arbitrary user 86 | chmod -R ugo=rwX "$@"; \ 87 | find "$@" -type d -exec chmod 1777 '{}' + 88 | 89 | # build for musl-libc, not glibc (see https://github.com/sparklemotion/nokogiri/issues/2075, https://github.com/rubygems/rubygems/issues/3174) 90 | ENV BUNDLE_FORCE_RUBY_PLATFORM 1 91 | RUN set -eux; \ 92 | apk add --no-cache --virtual .build-deps \ 93 | coreutils \ 94 | freetds-dev \ 95 | gcc \ 96 | make \ 97 | mariadb-dev \ 98 | musl-dev \ 99 | patch \ 100 | postgresql-dev \ 101 | sqlite-dev \ 102 | ttf2ufm \ 103 | yaml-dev \ 104 | zlib-dev \ 105 | ; \ 106 | \ 107 | gosu redmine bundle config --local without 'development test'; \ 108 | # https://github.com/redmine/redmine/commit/23dc108e70a0794f444803ac827a690085dcd557 109 | # ("gem puma" already exists in the Gemfile, but under "group :test" and we want it all the time) 110 | puma="$(grep -E "^[[:space:]]*gem [:'\"]puma['\",[:space:]].*\$" Gemfile)"; \ 111 | { echo; echo "$puma"; } | sed -re 's/^[[:space:]]+//' >> Gemfile; \ 112 | # fill up "database.yml" with bogus entries so the redmine Gemfile will pre-install all database adapter dependencies 113 | # https://github.com/redmine/redmine/blob/e9f9767089a4e3efbd73c35fc55c5c7eb85dd7d3/Gemfile#L50-L79 114 | echo '# the following entries only exist to force `bundle install` to pre-install all database adapter dependencies -- they can be safely removed/ignored' > ./config/database.yml; \ 115 | for adapter in mysql2 postgresql sqlserver sqlite3; do \ 116 | echo "$adapter:" >> ./config/database.yml; \ 117 | echo " adapter: $adapter" >> ./config/database.yml; \ 118 | done; \ 119 | gosu redmine bundle install --jobs "$(nproc)"; \ 120 | rm ./config/database.yml; \ 121 | # fix permissions for running as an arbitrary user 122 | chmod -R ugo=rwX Gemfile.lock "$GEM_HOME"; \ 123 | rm -rf ~redmine/.bundle; \ 124 | \ 125 | # https://github.com/naitoh/rbpdf/issues/31 126 | rm /usr/local/bundle/gems/rbpdf-font-1.19.*/lib/fonts/ttf2ufm/ttf2ufm; \ 127 | \ 128 | runDeps="$( \ 129 | scanelf --needed --nobanner --format '%n#p' --recursive /usr/local/bundle/gems \ 130 | | tr ',' '\n' \ 131 | | sort -u \ 132 | | awk ' \ 133 | system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } \ 134 | { print "so:" $1 } \ 135 | ' \ 136 | )"; \ 137 | apk add --no-network --virtual .redmine-rundeps $runDeps; \ 138 | apk del --no-network .build-deps 139 | 140 | VOLUME /usr/src/redmine/files 141 | 142 | COPY docker-entrypoint.sh / 143 | ENTRYPOINT ["/docker-entrypoint.sh"] 144 | 145 | EXPOSE 3000 146 | CMD ["rails", "server", "-b", "0.0.0.0"] 147 | -------------------------------------------------------------------------------- /6.0/trixie/Dockerfile: -------------------------------------------------------------------------------- 1 | # 2 | # NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" 3 | # 4 | # PLEASE DO NOT EDIT IT DIRECTLY. 5 | # 6 | 7 | FROM ruby:3.3-slim-trixie 8 | 9 | # explicitly set uid/gid to guarantee that it won't change in the future 10 | # the values 999:999 are identical to the current user/group id assigned 11 | RUN groupadd -r -g 999 redmine && useradd -r -g redmine -u 999 redmine 12 | 13 | RUN set -eux; \ 14 | apt-get update; \ 15 | apt-get install -y --no-install-recommends \ 16 | bzr \ 17 | ca-certificates \ 18 | ghostscript \ 19 | git \ 20 | gsfonts \ 21 | imagemagick \ 22 | mercurial \ 23 | openssh-client \ 24 | subversion \ 25 | tini \ 26 | wget \ 27 | ; \ 28 | rm -rf /var/lib/apt/lists/* 29 | 30 | # grab gosu for easy step-down from root 31 | # https://github.com/tianon/gosu/releases 32 | ENV GOSU_VERSION 1.19 33 | RUN set -eux; \ 34 | \ 35 | savedAptMark="$(apt-mark showmanual)"; \ 36 | apt-get update; \ 37 | apt-get install -y --no-install-recommends \ 38 | gnupg \ 39 | ; \ 40 | rm -rf /var/lib/apt/lists/*; \ 41 | \ 42 | dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')"; \ 43 | wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch"; \ 44 | wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch.asc"; \ 45 | export GNUPGHOME="$(mktemp -d)"; \ 46 | gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4; \ 47 | gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu; \ 48 | gpgconf --kill all; \ 49 | rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc; \ 50 | \ 51 | apt-mark auto '.*' > /dev/null; \ 52 | apt-mark manual $savedAptMark > /dev/null; \ 53 | apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ 54 | \ 55 | # smoke test 56 | chmod +x /usr/local/bin/gosu; \ 57 | gosu --version; \ 58 | gosu nobody true 59 | 60 | ENV RAILS_ENV production 61 | WORKDIR /usr/src/redmine 62 | 63 | # https://github.com/docker-library/redmine/issues/138#issuecomment-438834176 64 | # (bundler needs this for running as an arbitrary user) 65 | ENV HOME /home/redmine 66 | RUN set -eux; \ 67 | [ ! -d "$HOME" ]; \ 68 | mkdir -p "$HOME"; \ 69 | chown redmine:redmine "$HOME"; \ 70 | chmod 1777 "$HOME" 71 | 72 | ENV REDMINE_VERSION 6.0.7 73 | ENV REDMINE_DOWNLOAD_URL https://www.redmine.org/releases/redmine-6.0.7.tar.gz 74 | ENV REDMINE_DOWNLOAD_SHA256 8824560a07673dc7b59f1ca0bf9d7cd854c6c4c97d0fe555a5dbeba332b8dfe8 75 | ENV RAILS_LOG_TO_STDOUT true 76 | 77 | RUN set -eux; \ 78 | wget -O redmine.tar.gz "$REDMINE_DOWNLOAD_URL"; \ 79 | echo "$REDMINE_DOWNLOAD_SHA256 *redmine.tar.gz" | sha256sum -c -; \ 80 | tar -xf redmine.tar.gz --strip-components=1; \ 81 | rm redmine.tar.gz files/delete.me log/delete.me; \ 82 | # https://www.redmine.org/projects/redmine/wiki/RedmineInstall#Step-8-File-system-permissions 83 | set -- 'config' 'db' 'log' 'public/assets' 'sqlite' 'tmp' 'tmp/pdf' 'tmp/pids'; \ 84 | mkdir -p "$@"; \ 85 | chown -R redmine:redmine ./; \ 86 | # fix permissions for running as an arbitrary user 87 | chmod -R ugo=rwX "$@"; \ 88 | find "$@" -type d -exec chmod 1777 '{}' + 89 | 90 | RUN set -eux; \ 91 | savedAptMark="$(apt-mark showmanual)"; \ 92 | apt-get update; \ 93 | apt-get install -y --no-install-recommends \ 94 | default-libmysqlclient-dev \ 95 | freetds-dev \ 96 | gcc \ 97 | libpq-dev \ 98 | libsqlite3-dev \ 99 | libxml2-dev \ 100 | libxslt-dev \ 101 | libyaml-dev \ 102 | make \ 103 | patch \ 104 | pkgconf \ 105 | xz-utils \ 106 | ; \ 107 | rm -rf /var/lib/apt/lists/*; \ 108 | \ 109 | gosu redmine bundle config --local without 'development test'; \ 110 | # https://github.com/redmine/redmine/commit/23dc108e70a0794f444803ac827a690085dcd557 111 | # ("gem puma" already exists in the Gemfile, but under "group :test" and we want it all the time) 112 | puma="$(grep -E "^[[:space:]]*gem [:'\"]puma['\",[:space:]].*\$" Gemfile)"; \ 113 | { echo; echo "$puma"; } | sed -re 's/^[[:space:]]+//' >> Gemfile; \ 114 | # fill up "database.yml" with bogus entries so the redmine Gemfile will pre-install all database adapter dependencies 115 | # https://github.com/redmine/redmine/blob/e9f9767089a4e3efbd73c35fc55c5c7eb85dd7d3/Gemfile#L50-L79 116 | echo '# the following entries only exist to force `bundle install` to pre-install all database adapter dependencies -- they can be safely removed/ignored' > ./config/database.yml; \ 117 | for adapter in mysql2 postgresql sqlserver sqlite3; do \ 118 | echo "$adapter:" >> ./config/database.yml; \ 119 | echo " adapter: $adapter" >> ./config/database.yml; \ 120 | done; \ 121 | # nokogiri's vendored libxml2 + libxslt do not build on mips64le, so use the apt packages when building 122 | gosu redmine bundle config build.nokogiri --use-system-libraries; \ 123 | gosu redmine bundle install --jobs "$(nproc)"; \ 124 | rm ./config/database.yml; \ 125 | # fix permissions for running as an arbitrary user 126 | chmod -R ugo=rwX Gemfile.lock "$GEM_HOME"; \ 127 | rm -rf ~redmine/.bundle; \ 128 | \ 129 | # reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies 130 | apt-mark auto '.*' > /dev/null; \ 131 | [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ 132 | find /usr/local -type f -executable -exec ldd '{}' ';' \ 133 | | awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); printf "*%s\n", so }' \ 134 | | sort -u \ 135 | | xargs -rt dpkg-query --search \ 136 | # https://manpages.debian.org/trixie/dpkg/dpkg-query.1.en.html#S (we ignore diversions and it'll be really unusual for more than one package to provide any given .so file) 137 | | awk 'sub(":$", "", $1) { print $1 }' \ 138 | | sort -u \ 139 | | xargs -r apt-mark manual \ 140 | ; \ 141 | apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false 142 | 143 | VOLUME /usr/src/redmine/files 144 | 145 | COPY docker-entrypoint.sh / 146 | ENTRYPOINT ["/docker-entrypoint.sh"] 147 | 148 | EXPOSE 3000 149 | CMD ["rails", "server", "-b", "0.0.0.0"] 150 | -------------------------------------------------------------------------------- /5.1/trixie/Dockerfile: -------------------------------------------------------------------------------- 1 | # 2 | # NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" 3 | # 4 | # PLEASE DO NOT EDIT IT DIRECTLY. 5 | # 6 | 7 | FROM ruby:3.2-slim-trixie 8 | 9 | # explicitly set uid/gid to guarantee that it won't change in the future 10 | # the values 999:999 are identical to the current user/group id assigned 11 | RUN groupadd -r -g 999 redmine && useradd -r -g redmine -u 999 redmine 12 | 13 | RUN set -eux; \ 14 | apt-get update; \ 15 | apt-get install -y --no-install-recommends \ 16 | bzr \ 17 | ca-certificates \ 18 | ghostscript \ 19 | git \ 20 | gsfonts \ 21 | imagemagick \ 22 | mercurial \ 23 | openssh-client \ 24 | subversion \ 25 | tini \ 26 | wget \ 27 | ; \ 28 | rm -rf /var/lib/apt/lists/* 29 | 30 | # grab gosu for easy step-down from root 31 | # https://github.com/tianon/gosu/releases 32 | ENV GOSU_VERSION 1.19 33 | RUN set -eux; \ 34 | \ 35 | savedAptMark="$(apt-mark showmanual)"; \ 36 | apt-get update; \ 37 | apt-get install -y --no-install-recommends \ 38 | gnupg \ 39 | ; \ 40 | rm -rf /var/lib/apt/lists/*; \ 41 | \ 42 | dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')"; \ 43 | wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch"; \ 44 | wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch.asc"; \ 45 | export GNUPGHOME="$(mktemp -d)"; \ 46 | gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4; \ 47 | gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu; \ 48 | gpgconf --kill all; \ 49 | rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc; \ 50 | \ 51 | apt-mark auto '.*' > /dev/null; \ 52 | apt-mark manual $savedAptMark > /dev/null; \ 53 | apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ 54 | \ 55 | # smoke test 56 | chmod +x /usr/local/bin/gosu; \ 57 | gosu --version; \ 58 | gosu nobody true 59 | 60 | ENV RAILS_ENV production 61 | WORKDIR /usr/src/redmine 62 | 63 | # https://github.com/docker-library/redmine/issues/138#issuecomment-438834176 64 | # (bundler needs this for running as an arbitrary user) 65 | ENV HOME /home/redmine 66 | RUN set -eux; \ 67 | [ ! -d "$HOME" ]; \ 68 | mkdir -p "$HOME"; \ 69 | chown redmine:redmine "$HOME"; \ 70 | chmod 1777 "$HOME" 71 | 72 | ENV REDMINE_VERSION 5.1.10 73 | ENV REDMINE_DOWNLOAD_URL https://www.redmine.org/releases/redmine-5.1.10.tar.gz 74 | ENV REDMINE_DOWNLOAD_SHA256 0f187dcca0804f42faf7bbee1ad0a759291b026f707d86347bc14f34defa6f41 75 | ENV RAILS_LOG_TO_STDOUT true 76 | 77 | RUN set -eux; \ 78 | wget -O redmine.tar.gz "$REDMINE_DOWNLOAD_URL"; \ 79 | echo "$REDMINE_DOWNLOAD_SHA256 *redmine.tar.gz" | sha256sum -c -; \ 80 | tar -xf redmine.tar.gz --strip-components=1; \ 81 | rm redmine.tar.gz files/delete.me log/delete.me; \ 82 | # https://www.redmine.org/projects/redmine/wiki/RedmineInstall#Step-8-File-system-permissions 83 | set -- 'config' 'db' 'log' 'public/plugin_assets' 'sqlite' 'tmp' 'tmp/pdf' 'tmp/pids'; \ 84 | mkdir -p "$@"; \ 85 | chown -R redmine:redmine ./; \ 86 | # fix permissions for running as an arbitrary user 87 | chmod -R ugo=rwX "$@"; \ 88 | find "$@" -type d -exec chmod 1777 '{}' + 89 | 90 | RUN set -eux; \ 91 | savedAptMark="$(apt-mark showmanual)"; \ 92 | apt-get update; \ 93 | apt-get install -y --no-install-recommends \ 94 | default-libmysqlclient-dev \ 95 | freetds-dev \ 96 | gcc \ 97 | libpq-dev \ 98 | libsqlite3-dev \ 99 | libxml2-dev \ 100 | libxslt-dev \ 101 | libyaml-dev \ 102 | make \ 103 | patch \ 104 | pkgconf \ 105 | xz-utils \ 106 | ; \ 107 | rm -rf /var/lib/apt/lists/*; \ 108 | \ 109 | gosu redmine bundle config --local without 'development test'; \ 110 | # https://github.com/redmine/redmine/commit/23dc108e70a0794f444803ac827a690085dcd557 111 | # ("gem puma" already exists in the Gemfile, but under "group :test" and we want it all the time) 112 | puma="$(grep -E "^[[:space:]]*gem [:'\"]puma['\",[:space:]].*\$" Gemfile)"; \ 113 | { echo; echo "$puma"; } | sed -re 's/^[[:space:]]+//' >> Gemfile; \ 114 | # fill up "database.yml" with bogus entries so the redmine Gemfile will pre-install all database adapter dependencies 115 | # https://github.com/redmine/redmine/blob/e9f9767089a4e3efbd73c35fc55c5c7eb85dd7d3/Gemfile#L50-L79 116 | echo '# the following entries only exist to force `bundle install` to pre-install all database adapter dependencies -- they can be safely removed/ignored' > ./config/database.yml; \ 117 | for adapter in mysql2 postgresql sqlserver sqlite3; do \ 118 | echo "$adapter:" >> ./config/database.yml; \ 119 | echo " adapter: $adapter" >> ./config/database.yml; \ 120 | done; \ 121 | # nokogiri's vendored libxml2 + libxslt do not build on mips64le, so use the apt packages when building 122 | gosu redmine bundle config build.nokogiri --use-system-libraries; \ 123 | gosu redmine bundle install --jobs "$(nproc)"; \ 124 | rm ./config/database.yml; \ 125 | # fix permissions for running as an arbitrary user 126 | chmod -R ugo=rwX Gemfile.lock "$GEM_HOME"; \ 127 | rm -rf ~redmine/.bundle; \ 128 | \ 129 | # reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies 130 | apt-mark auto '.*' > /dev/null; \ 131 | [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ 132 | find /usr/local -type f -executable -exec ldd '{}' ';' \ 133 | | awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); printf "*%s\n", so }' \ 134 | | sort -u \ 135 | | xargs -rt dpkg-query --search \ 136 | # https://manpages.debian.org/trixie/dpkg/dpkg-query.1.en.html#S (we ignore diversions and it'll be really unusual for more than one package to provide any given .so file) 137 | | awk 'sub(":$", "", $1) { print $1 }' \ 138 | | sort -u \ 139 | | xargs -r apt-mark manual \ 140 | ; \ 141 | apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false 142 | 143 | VOLUME /usr/src/redmine/files 144 | 145 | COPY docker-entrypoint.sh / 146 | ENTRYPOINT ["/docker-entrypoint.sh"] 147 | 148 | EXPOSE 3000 149 | CMD ["rails", "server", "-b", "0.0.0.0"] 150 | -------------------------------------------------------------------------------- /6.1/trixie/Dockerfile: -------------------------------------------------------------------------------- 1 | # 2 | # NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" 3 | # 4 | # PLEASE DO NOT EDIT IT DIRECTLY. 5 | # 6 | 7 | FROM ruby:3.4-slim-trixie 8 | 9 | # explicitly set uid/gid to guarantee that it won't change in the future 10 | # the values 999:999 are identical to the current user/group id assigned 11 | RUN groupadd -r -g 999 redmine && useradd -r -g redmine -u 999 redmine 12 | 13 | RUN set -eux; \ 14 | apt-get update; \ 15 | apt-get install -y --no-install-recommends \ 16 | bzr \ 17 | ca-certificates \ 18 | ghostscript \ 19 | git \ 20 | gsfonts \ 21 | imagemagick \ 22 | mercurial \ 23 | openssh-client \ 24 | subversion \ 25 | tini \ 26 | wget \ 27 | ; \ 28 | rm -rf /var/lib/apt/lists/* 29 | 30 | # grab gosu for easy step-down from root 31 | # https://github.com/tianon/gosu/releases 32 | ENV GOSU_VERSION 1.19 33 | RUN set -eux; \ 34 | \ 35 | savedAptMark="$(apt-mark showmanual)"; \ 36 | apt-get update; \ 37 | apt-get install -y --no-install-recommends \ 38 | gnupg \ 39 | ; \ 40 | rm -rf /var/lib/apt/lists/*; \ 41 | \ 42 | dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')"; \ 43 | wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch"; \ 44 | wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch.asc"; \ 45 | export GNUPGHOME="$(mktemp -d)"; \ 46 | gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4; \ 47 | gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu; \ 48 | gpgconf --kill all; \ 49 | rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc; \ 50 | \ 51 | apt-mark auto '.*' > /dev/null; \ 52 | apt-mark manual $savedAptMark > /dev/null; \ 53 | apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ 54 | \ 55 | # smoke test 56 | chmod +x /usr/local/bin/gosu; \ 57 | gosu --version; \ 58 | gosu nobody true 59 | 60 | ENV RAILS_ENV production 61 | WORKDIR /usr/src/redmine 62 | 63 | # https://github.com/docker-library/redmine/issues/138#issuecomment-438834176 64 | # (bundler needs this for running as an arbitrary user) 65 | ENV HOME /home/redmine 66 | RUN set -eux; \ 67 | [ ! -d "$HOME" ]; \ 68 | mkdir -p "$HOME"; \ 69 | chown redmine:redmine "$HOME"; \ 70 | chmod 1777 "$HOME" 71 | 72 | ENV REDMINE_VERSION 6.1.0 73 | ENV REDMINE_DOWNLOAD_URL https://www.redmine.org/releases/redmine-6.1.0.tar.gz 74 | ENV REDMINE_DOWNLOAD_SHA256 bc483da195f2444491d870e40f7fc909ae750f7ba8d0e28831e6d6c478812b88 75 | ENV RAILS_LOG_TO_STDOUT true 76 | 77 | RUN set -eux; \ 78 | wget -O redmine.tar.gz "$REDMINE_DOWNLOAD_URL"; \ 79 | echo "$REDMINE_DOWNLOAD_SHA256 *redmine.tar.gz" | sha256sum -c -; \ 80 | tar -xf redmine.tar.gz --strip-components=1; \ 81 | rm redmine.tar.gz files/delete.me log/delete.me; \ 82 | # https://www.redmine.org/projects/redmine/wiki/RedmineInstall#Step-8-File-system-permissions 83 | set -- 'config' 'db' 'log' 'public/assets' 'sqlite' 'tmp' 'tmp/pdf' 'tmp/pids'; \ 84 | mkdir -p "$@"; \ 85 | chown -R redmine:redmine ./; \ 86 | # fix permissions for running as an arbitrary user 87 | chmod -R ugo=rwX "$@"; \ 88 | find "$@" -type d -exec chmod 1777 '{}' + 89 | 90 | RUN set -eux; \ 91 | savedAptMark="$(apt-mark showmanual)"; \ 92 | apt-get update; \ 93 | apt-get install -y --no-install-recommends \ 94 | cargo \ 95 | default-libmysqlclient-dev \ 96 | freetds-dev \ 97 | gcc \ 98 | libclang-dev \ 99 | libpq-dev \ 100 | libsqlite3-dev \ 101 | libxml2-dev \ 102 | libxslt-dev \ 103 | libyaml-dev \ 104 | make \ 105 | patch \ 106 | pkgconf \ 107 | xz-utils \ 108 | ; \ 109 | rm -rf /var/lib/apt/lists/*; \ 110 | \ 111 | gosu redmine bundle config --local without 'development test'; \ 112 | # https://github.com/redmine/redmine/commit/23dc108e70a0794f444803ac827a690085dcd557 113 | # ("gem puma" already exists in the Gemfile, but under "group :test" and we want it all the time) 114 | puma="$(grep -E "^[[:space:]]*gem [:'\"]puma['\",[:space:]].*\$" Gemfile)"; \ 115 | { echo; echo "$puma"; } | sed -re 's/^[[:space:]]+//' >> Gemfile; \ 116 | # fill up "database.yml" with bogus entries so the redmine Gemfile will pre-install all database adapter dependencies 117 | # https://github.com/redmine/redmine/blob/e9f9767089a4e3efbd73c35fc55c5c7eb85dd7d3/Gemfile#L50-L79 118 | echo '# the following entries only exist to force `bundle install` to pre-install all database adapter dependencies -- they can be safely removed/ignored' > ./config/database.yml; \ 119 | for adapter in mysql2 postgresql sqlserver sqlite3; do \ 120 | echo "$adapter:" >> ./config/database.yml; \ 121 | echo " adapter: $adapter" >> ./config/database.yml; \ 122 | done; \ 123 | # nokogiri's vendored libxml2 + libxslt do not build on mips64le, so use the apt packages when building 124 | gosu redmine bundle config build.nokogiri --use-system-libraries; \ 125 | gosu redmine bundle install --jobs "$(nproc)"; \ 126 | rm ./config/database.yml; \ 127 | # fix permissions for running as an arbitrary user 128 | chmod -R ugo=rwX Gemfile.lock "$GEM_HOME"; \ 129 | rm -rf ~redmine/.bundle; \ 130 | \ 131 | # reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies 132 | apt-mark auto '.*' > /dev/null; \ 133 | [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ 134 | find /usr/local -type f -executable -exec ldd '{}' ';' \ 135 | | awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); printf "*%s\n", so }' \ 136 | | sort -u \ 137 | | xargs -rt dpkg-query --search \ 138 | # https://manpages.debian.org/trixie/dpkg/dpkg-query.1.en.html#S (we ignore diversions and it'll be really unusual for more than one package to provide any given .so file) 139 | | awk 'sub(":$", "", $1) { print $1 }' \ 140 | | sort -u \ 141 | | xargs -r apt-mark manual \ 142 | ; \ 143 | apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false 144 | 145 | VOLUME /usr/src/redmine/files 146 | 147 | COPY docker-entrypoint.sh / 148 | ENTRYPOINT ["/docker-entrypoint.sh"] 149 | 150 | EXPOSE 3000 151 | CMD ["rails", "server", "-b", "0.0.0.0"] 152 | -------------------------------------------------------------------------------- /6.0/bookworm/Dockerfile: -------------------------------------------------------------------------------- 1 | # 2 | # NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" 3 | # 4 | # PLEASE DO NOT EDIT IT DIRECTLY. 5 | # 6 | 7 | FROM ruby:3.3-slim-bookworm 8 | 9 | # explicitly set uid/gid to guarantee that it won't change in the future 10 | # the values 999:999 are identical to the current user/group id assigned 11 | RUN groupadd -r -g 999 redmine && useradd -r -g redmine -u 999 redmine 12 | 13 | RUN set -eux; \ 14 | apt-get update; \ 15 | apt-get install -y --no-install-recommends \ 16 | bzr \ 17 | ca-certificates \ 18 | ghostscript \ 19 | git \ 20 | gsfonts \ 21 | imagemagick \ 22 | mercurial \ 23 | openssh-client \ 24 | subversion \ 25 | tini \ 26 | wget \ 27 | ; \ 28 | # allow imagemagick to use ghostscript for PDF -> PNG thumbnail conversion (4.1+) 29 | sed -ri 's/(rights)="none" (pattern="PDF")/\1="read" \2/' /etc/ImageMagick-6/policy.xml; \ 30 | rm -rf /var/lib/apt/lists/* 31 | 32 | # grab gosu for easy step-down from root 33 | # https://github.com/tianon/gosu/releases 34 | ENV GOSU_VERSION 1.19 35 | RUN set -eux; \ 36 | \ 37 | savedAptMark="$(apt-mark showmanual)"; \ 38 | apt-get update; \ 39 | apt-get install -y --no-install-recommends \ 40 | gnupg \ 41 | ; \ 42 | rm -rf /var/lib/apt/lists/*; \ 43 | \ 44 | dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')"; \ 45 | wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch"; \ 46 | wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch.asc"; \ 47 | export GNUPGHOME="$(mktemp -d)"; \ 48 | gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4; \ 49 | gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu; \ 50 | gpgconf --kill all; \ 51 | rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc; \ 52 | \ 53 | apt-mark auto '.*' > /dev/null; \ 54 | apt-mark manual $savedAptMark > /dev/null; \ 55 | apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ 56 | \ 57 | # smoke test 58 | chmod +x /usr/local/bin/gosu; \ 59 | gosu --version; \ 60 | gosu nobody true 61 | 62 | ENV RAILS_ENV production 63 | WORKDIR /usr/src/redmine 64 | 65 | # https://github.com/docker-library/redmine/issues/138#issuecomment-438834176 66 | # (bundler needs this for running as an arbitrary user) 67 | ENV HOME /home/redmine 68 | RUN set -eux; \ 69 | [ ! -d "$HOME" ]; \ 70 | mkdir -p "$HOME"; \ 71 | chown redmine:redmine "$HOME"; \ 72 | chmod 1777 "$HOME" 73 | 74 | ENV REDMINE_VERSION 6.0.7 75 | ENV REDMINE_DOWNLOAD_URL https://www.redmine.org/releases/redmine-6.0.7.tar.gz 76 | ENV REDMINE_DOWNLOAD_SHA256 8824560a07673dc7b59f1ca0bf9d7cd854c6c4c97d0fe555a5dbeba332b8dfe8 77 | ENV RAILS_LOG_TO_STDOUT true 78 | 79 | RUN set -eux; \ 80 | wget -O redmine.tar.gz "$REDMINE_DOWNLOAD_URL"; \ 81 | echo "$REDMINE_DOWNLOAD_SHA256 *redmine.tar.gz" | sha256sum -c -; \ 82 | tar -xf redmine.tar.gz --strip-components=1; \ 83 | rm redmine.tar.gz files/delete.me log/delete.me; \ 84 | # https://www.redmine.org/projects/redmine/wiki/RedmineInstall#Step-8-File-system-permissions 85 | set -- 'config' 'db' 'log' 'public/assets' 'sqlite' 'tmp' 'tmp/pdf' 'tmp/pids'; \ 86 | mkdir -p "$@"; \ 87 | chown -R redmine:redmine ./; \ 88 | # fix permissions for running as an arbitrary user 89 | chmod -R ugo=rwX "$@"; \ 90 | find "$@" -type d -exec chmod 1777 '{}' + 91 | 92 | RUN set -eux; \ 93 | savedAptMark="$(apt-mark showmanual)"; \ 94 | apt-get update; \ 95 | apt-get install -y --no-install-recommends \ 96 | default-libmysqlclient-dev \ 97 | freetds-dev \ 98 | gcc \ 99 | libpq-dev \ 100 | libsqlite3-dev \ 101 | libxml2-dev \ 102 | libxslt-dev \ 103 | libyaml-dev \ 104 | make \ 105 | patch \ 106 | pkgconf \ 107 | xz-utils \ 108 | ; \ 109 | rm -rf /var/lib/apt/lists/*; \ 110 | \ 111 | gosu redmine bundle config --local without 'development test'; \ 112 | # https://github.com/redmine/redmine/commit/23dc108e70a0794f444803ac827a690085dcd557 113 | # ("gem puma" already exists in the Gemfile, but under "group :test" and we want it all the time) 114 | puma="$(grep -E "^[[:space:]]*gem [:'\"]puma['\",[:space:]].*\$" Gemfile)"; \ 115 | { echo; echo "$puma"; } | sed -re 's/^[[:space:]]+//' >> Gemfile; \ 116 | # fill up "database.yml" with bogus entries so the redmine Gemfile will pre-install all database adapter dependencies 117 | # https://github.com/redmine/redmine/blob/e9f9767089a4e3efbd73c35fc55c5c7eb85dd7d3/Gemfile#L50-L79 118 | echo '# the following entries only exist to force `bundle install` to pre-install all database adapter dependencies -- they can be safely removed/ignored' > ./config/database.yml; \ 119 | for adapter in mysql2 postgresql sqlserver sqlite3; do \ 120 | echo "$adapter:" >> ./config/database.yml; \ 121 | echo " adapter: $adapter" >> ./config/database.yml; \ 122 | done; \ 123 | # nokogiri's vendored libxml2 + libxslt do not build on mips64le, so use the apt packages when building 124 | gosu redmine bundle config build.nokogiri --use-system-libraries; \ 125 | gosu redmine bundle install --jobs "$(nproc)"; \ 126 | rm ./config/database.yml; \ 127 | # fix permissions for running as an arbitrary user 128 | chmod -R ugo=rwX Gemfile.lock "$GEM_HOME"; \ 129 | rm -rf ~redmine/.bundle; \ 130 | \ 131 | # reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies 132 | apt-mark auto '.*' > /dev/null; \ 133 | [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ 134 | find /usr/local -type f -executable -exec ldd '{}' ';' \ 135 | | awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); printf "*%s\n", so }' \ 136 | | sort -u \ 137 | | xargs -rt dpkg-query --search \ 138 | # https://manpages.debian.org/trixie/dpkg/dpkg-query.1.en.html#S (we ignore diversions and it'll be really unusual for more than one package to provide any given .so file) 139 | | awk 'sub(":$", "", $1) { print $1 }' \ 140 | | sort -u \ 141 | | xargs -r apt-mark manual \ 142 | ; \ 143 | apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false 144 | 145 | VOLUME /usr/src/redmine/files 146 | 147 | COPY docker-entrypoint.sh / 148 | ENTRYPOINT ["/docker-entrypoint.sh"] 149 | 150 | EXPOSE 3000 151 | CMD ["rails", "server", "-b", "0.0.0.0"] 152 | -------------------------------------------------------------------------------- /5.1/bookworm/Dockerfile: -------------------------------------------------------------------------------- 1 | # 2 | # NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" 3 | # 4 | # PLEASE DO NOT EDIT IT DIRECTLY. 5 | # 6 | 7 | FROM ruby:3.2-slim-bookworm 8 | 9 | # explicitly set uid/gid to guarantee that it won't change in the future 10 | # the values 999:999 are identical to the current user/group id assigned 11 | RUN groupadd -r -g 999 redmine && useradd -r -g redmine -u 999 redmine 12 | 13 | RUN set -eux; \ 14 | apt-get update; \ 15 | apt-get install -y --no-install-recommends \ 16 | bzr \ 17 | ca-certificates \ 18 | ghostscript \ 19 | git \ 20 | gsfonts \ 21 | imagemagick \ 22 | mercurial \ 23 | openssh-client \ 24 | subversion \ 25 | tini \ 26 | wget \ 27 | ; \ 28 | # allow imagemagick to use ghostscript for PDF -> PNG thumbnail conversion (4.1+) 29 | sed -ri 's/(rights)="none" (pattern="PDF")/\1="read" \2/' /etc/ImageMagick-6/policy.xml; \ 30 | rm -rf /var/lib/apt/lists/* 31 | 32 | # grab gosu for easy step-down from root 33 | # https://github.com/tianon/gosu/releases 34 | ENV GOSU_VERSION 1.19 35 | RUN set -eux; \ 36 | \ 37 | savedAptMark="$(apt-mark showmanual)"; \ 38 | apt-get update; \ 39 | apt-get install -y --no-install-recommends \ 40 | gnupg \ 41 | ; \ 42 | rm -rf /var/lib/apt/lists/*; \ 43 | \ 44 | dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')"; \ 45 | wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch"; \ 46 | wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch.asc"; \ 47 | export GNUPGHOME="$(mktemp -d)"; \ 48 | gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4; \ 49 | gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu; \ 50 | gpgconf --kill all; \ 51 | rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc; \ 52 | \ 53 | apt-mark auto '.*' > /dev/null; \ 54 | apt-mark manual $savedAptMark > /dev/null; \ 55 | apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ 56 | \ 57 | # smoke test 58 | chmod +x /usr/local/bin/gosu; \ 59 | gosu --version; \ 60 | gosu nobody true 61 | 62 | ENV RAILS_ENV production 63 | WORKDIR /usr/src/redmine 64 | 65 | # https://github.com/docker-library/redmine/issues/138#issuecomment-438834176 66 | # (bundler needs this for running as an arbitrary user) 67 | ENV HOME /home/redmine 68 | RUN set -eux; \ 69 | [ ! -d "$HOME" ]; \ 70 | mkdir -p "$HOME"; \ 71 | chown redmine:redmine "$HOME"; \ 72 | chmod 1777 "$HOME" 73 | 74 | ENV REDMINE_VERSION 5.1.10 75 | ENV REDMINE_DOWNLOAD_URL https://www.redmine.org/releases/redmine-5.1.10.tar.gz 76 | ENV REDMINE_DOWNLOAD_SHA256 0f187dcca0804f42faf7bbee1ad0a759291b026f707d86347bc14f34defa6f41 77 | ENV RAILS_LOG_TO_STDOUT true 78 | 79 | RUN set -eux; \ 80 | wget -O redmine.tar.gz "$REDMINE_DOWNLOAD_URL"; \ 81 | echo "$REDMINE_DOWNLOAD_SHA256 *redmine.tar.gz" | sha256sum -c -; \ 82 | tar -xf redmine.tar.gz --strip-components=1; \ 83 | rm redmine.tar.gz files/delete.me log/delete.me; \ 84 | # https://www.redmine.org/projects/redmine/wiki/RedmineInstall#Step-8-File-system-permissions 85 | set -- 'config' 'db' 'log' 'public/plugin_assets' 'sqlite' 'tmp' 'tmp/pdf' 'tmp/pids'; \ 86 | mkdir -p "$@"; \ 87 | chown -R redmine:redmine ./; \ 88 | # fix permissions for running as an arbitrary user 89 | chmod -R ugo=rwX "$@"; \ 90 | find "$@" -type d -exec chmod 1777 '{}' + 91 | 92 | RUN set -eux; \ 93 | savedAptMark="$(apt-mark showmanual)"; \ 94 | apt-get update; \ 95 | apt-get install -y --no-install-recommends \ 96 | default-libmysqlclient-dev \ 97 | freetds-dev \ 98 | gcc \ 99 | libpq-dev \ 100 | libsqlite3-dev \ 101 | libxml2-dev \ 102 | libxslt-dev \ 103 | libyaml-dev \ 104 | make \ 105 | patch \ 106 | pkgconf \ 107 | xz-utils \ 108 | ; \ 109 | rm -rf /var/lib/apt/lists/*; \ 110 | \ 111 | gosu redmine bundle config --local without 'development test'; \ 112 | # https://github.com/redmine/redmine/commit/23dc108e70a0794f444803ac827a690085dcd557 113 | # ("gem puma" already exists in the Gemfile, but under "group :test" and we want it all the time) 114 | puma="$(grep -E "^[[:space:]]*gem [:'\"]puma['\",[:space:]].*\$" Gemfile)"; \ 115 | { echo; echo "$puma"; } | sed -re 's/^[[:space:]]+//' >> Gemfile; \ 116 | # fill up "database.yml" with bogus entries so the redmine Gemfile will pre-install all database adapter dependencies 117 | # https://github.com/redmine/redmine/blob/e9f9767089a4e3efbd73c35fc55c5c7eb85dd7d3/Gemfile#L50-L79 118 | echo '# the following entries only exist to force `bundle install` to pre-install all database adapter dependencies -- they can be safely removed/ignored' > ./config/database.yml; \ 119 | for adapter in mysql2 postgresql sqlserver sqlite3; do \ 120 | echo "$adapter:" >> ./config/database.yml; \ 121 | echo " adapter: $adapter" >> ./config/database.yml; \ 122 | done; \ 123 | # nokogiri's vendored libxml2 + libxslt do not build on mips64le, so use the apt packages when building 124 | gosu redmine bundle config build.nokogiri --use-system-libraries; \ 125 | gosu redmine bundle install --jobs "$(nproc)"; \ 126 | rm ./config/database.yml; \ 127 | # fix permissions for running as an arbitrary user 128 | chmod -R ugo=rwX Gemfile.lock "$GEM_HOME"; \ 129 | rm -rf ~redmine/.bundle; \ 130 | \ 131 | # reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies 132 | apt-mark auto '.*' > /dev/null; \ 133 | [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ 134 | find /usr/local -type f -executable -exec ldd '{}' ';' \ 135 | | awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); printf "*%s\n", so }' \ 136 | | sort -u \ 137 | | xargs -rt dpkg-query --search \ 138 | # https://manpages.debian.org/trixie/dpkg/dpkg-query.1.en.html#S (we ignore diversions and it'll be really unusual for more than one package to provide any given .so file) 139 | | awk 'sub(":$", "", $1) { print $1 }' \ 140 | | sort -u \ 141 | | xargs -r apt-mark manual \ 142 | ; \ 143 | apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false 144 | 145 | VOLUME /usr/src/redmine/files 146 | 147 | COPY docker-entrypoint.sh / 148 | ENTRYPOINT ["/docker-entrypoint.sh"] 149 | 150 | EXPOSE 3000 151 | CMD ["rails", "server", "-b", "0.0.0.0"] 152 | -------------------------------------------------------------------------------- /6.1/bookworm/Dockerfile: -------------------------------------------------------------------------------- 1 | # 2 | # NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" 3 | # 4 | # PLEASE DO NOT EDIT IT DIRECTLY. 5 | # 6 | 7 | FROM ruby:3.4-slim-bookworm 8 | 9 | # explicitly set uid/gid to guarantee that it won't change in the future 10 | # the values 999:999 are identical to the current user/group id assigned 11 | RUN groupadd -r -g 999 redmine && useradd -r -g redmine -u 999 redmine 12 | 13 | RUN set -eux; \ 14 | apt-get update; \ 15 | apt-get install -y --no-install-recommends \ 16 | bzr \ 17 | ca-certificates \ 18 | ghostscript \ 19 | git \ 20 | gsfonts \ 21 | imagemagick \ 22 | mercurial \ 23 | openssh-client \ 24 | subversion \ 25 | tini \ 26 | wget \ 27 | ; \ 28 | # allow imagemagick to use ghostscript for PDF -> PNG thumbnail conversion (4.1+) 29 | sed -ri 's/(rights)="none" (pattern="PDF")/\1="read" \2/' /etc/ImageMagick-6/policy.xml; \ 30 | rm -rf /var/lib/apt/lists/* 31 | 32 | # grab gosu for easy step-down from root 33 | # https://github.com/tianon/gosu/releases 34 | ENV GOSU_VERSION 1.19 35 | RUN set -eux; \ 36 | \ 37 | savedAptMark="$(apt-mark showmanual)"; \ 38 | apt-get update; \ 39 | apt-get install -y --no-install-recommends \ 40 | gnupg \ 41 | ; \ 42 | rm -rf /var/lib/apt/lists/*; \ 43 | \ 44 | dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')"; \ 45 | wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch"; \ 46 | wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch.asc"; \ 47 | export GNUPGHOME="$(mktemp -d)"; \ 48 | gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4; \ 49 | gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu; \ 50 | gpgconf --kill all; \ 51 | rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc; \ 52 | \ 53 | apt-mark auto '.*' > /dev/null; \ 54 | apt-mark manual $savedAptMark > /dev/null; \ 55 | apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ 56 | \ 57 | # smoke test 58 | chmod +x /usr/local/bin/gosu; \ 59 | gosu --version; \ 60 | gosu nobody true 61 | 62 | ENV RAILS_ENV production 63 | WORKDIR /usr/src/redmine 64 | 65 | # https://github.com/docker-library/redmine/issues/138#issuecomment-438834176 66 | # (bundler needs this for running as an arbitrary user) 67 | ENV HOME /home/redmine 68 | RUN set -eux; \ 69 | [ ! -d "$HOME" ]; \ 70 | mkdir -p "$HOME"; \ 71 | chown redmine:redmine "$HOME"; \ 72 | chmod 1777 "$HOME" 73 | 74 | ENV REDMINE_VERSION 6.1.0 75 | ENV REDMINE_DOWNLOAD_URL https://www.redmine.org/releases/redmine-6.1.0.tar.gz 76 | ENV REDMINE_DOWNLOAD_SHA256 bc483da195f2444491d870e40f7fc909ae750f7ba8d0e28831e6d6c478812b88 77 | ENV RAILS_LOG_TO_STDOUT true 78 | 79 | RUN set -eux; \ 80 | wget -O redmine.tar.gz "$REDMINE_DOWNLOAD_URL"; \ 81 | echo "$REDMINE_DOWNLOAD_SHA256 *redmine.tar.gz" | sha256sum -c -; \ 82 | tar -xf redmine.tar.gz --strip-components=1; \ 83 | rm redmine.tar.gz files/delete.me log/delete.me; \ 84 | # https://www.redmine.org/projects/redmine/wiki/RedmineInstall#Step-8-File-system-permissions 85 | set -- 'config' 'db' 'log' 'public/assets' 'sqlite' 'tmp' 'tmp/pdf' 'tmp/pids'; \ 86 | mkdir -p "$@"; \ 87 | chown -R redmine:redmine ./; \ 88 | # fix permissions for running as an arbitrary user 89 | chmod -R ugo=rwX "$@"; \ 90 | find "$@" -type d -exec chmod 1777 '{}' + 91 | 92 | RUN set -eux; \ 93 | savedAptMark="$(apt-mark showmanual)"; \ 94 | apt-get update; \ 95 | apt-get install -y --no-install-recommends \ 96 | cargo \ 97 | default-libmysqlclient-dev \ 98 | freetds-dev \ 99 | gcc \ 100 | libclang-dev \ 101 | libpq-dev \ 102 | libsqlite3-dev \ 103 | libxml2-dev \ 104 | libxslt-dev \ 105 | libyaml-dev \ 106 | make \ 107 | patch \ 108 | pkgconf \ 109 | xz-utils \ 110 | ; \ 111 | rm -rf /var/lib/apt/lists/*; \ 112 | \ 113 | gosu redmine bundle config --local without 'development test'; \ 114 | # https://github.com/redmine/redmine/commit/23dc108e70a0794f444803ac827a690085dcd557 115 | # ("gem puma" already exists in the Gemfile, but under "group :test" and we want it all the time) 116 | puma="$(grep -E "^[[:space:]]*gem [:'\"]puma['\",[:space:]].*\$" Gemfile)"; \ 117 | { echo; echo "$puma"; } | sed -re 's/^[[:space:]]+//' >> Gemfile; \ 118 | # fill up "database.yml" with bogus entries so the redmine Gemfile will pre-install all database adapter dependencies 119 | # https://github.com/redmine/redmine/blob/e9f9767089a4e3efbd73c35fc55c5c7eb85dd7d3/Gemfile#L50-L79 120 | echo '# the following entries only exist to force `bundle install` to pre-install all database adapter dependencies -- they can be safely removed/ignored' > ./config/database.yml; \ 121 | for adapter in mysql2 postgresql sqlserver sqlite3; do \ 122 | echo "$adapter:" >> ./config/database.yml; \ 123 | echo " adapter: $adapter" >> ./config/database.yml; \ 124 | done; \ 125 | # nokogiri's vendored libxml2 + libxslt do not build on mips64le, so use the apt packages when building 126 | gosu redmine bundle config build.nokogiri --use-system-libraries; \ 127 | gosu redmine bundle install --jobs "$(nproc)"; \ 128 | rm ./config/database.yml; \ 129 | # fix permissions for running as an arbitrary user 130 | chmod -R ugo=rwX Gemfile.lock "$GEM_HOME"; \ 131 | rm -rf ~redmine/.bundle; \ 132 | \ 133 | # reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies 134 | apt-mark auto '.*' > /dev/null; \ 135 | [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ 136 | find /usr/local -type f -executable -exec ldd '{}' ';' \ 137 | | awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); printf "*%s\n", so }' \ 138 | | sort -u \ 139 | | xargs -rt dpkg-query --search \ 140 | # https://manpages.debian.org/trixie/dpkg/dpkg-query.1.en.html#S (we ignore diversions and it'll be really unusual for more than one package to provide any given .so file) 141 | | awk 'sub(":$", "", $1) { print $1 }' \ 142 | | sort -u \ 143 | | xargs -r apt-mark manual \ 144 | ; \ 145 | apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false 146 | 147 | VOLUME /usr/src/redmine/files 148 | 149 | COPY docker-entrypoint.sh / 150 | ENTRYPOINT ["/docker-entrypoint.sh"] 151 | 152 | EXPOSE 3000 153 | CMD ["rails", "server", "-b", "0.0.0.0"] 154 | -------------------------------------------------------------------------------- /docker-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -Eeo pipefail 3 | # TODO add "-u" 4 | 5 | # usage: file_env VAR [DEFAULT] 6 | # ie: file_env 'XYZ_DB_PASSWORD' 'example' 7 | # (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of 8 | # "$XYZ_DB_PASSWORD" from a file, especially for Docker's secrets feature) 9 | file_env() { 10 | local var="$1" 11 | local fileVar="${var}_FILE" 12 | local def="${2:-}" 13 | if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then 14 | echo >&2 "error: both $var and $fileVar are set (but are exclusive)" 15 | exit 1 16 | fi 17 | local val="$def" 18 | if [ "${!var:-}" ]; then 19 | val="${!var}" 20 | elif [ "${!fileVar:-}" ]; then 21 | val="$(< "${!fileVar}")" 22 | fi 23 | export "$var"="$val" 24 | unset "$fileVar" 25 | } 26 | 27 | isLikelyRedmine= 28 | case "$1" in 29 | rails | rake ) isLikelyRedmine=1 ;; 30 | bundle ) if [ "${2:-}" = 'exec' ]; then isLikelyRedmine=1; fi ;; # https://github.com/docker-library/redmine/pull/386 - "bundle exec sidekiq" 31 | esac 32 | 33 | _fix_permissions() { 34 | # https://www.redmine.org/projects/redmine/wiki/RedmineInstall#Step-8-File-system-permissions 35 | local dirs=( config log public/*assets tmp ) args=() 36 | if [ "$(id -u)" = '0' ]; then 37 | args+=( ${args[@]:+,} '(' '!' -user redmine -exec chown redmine:redmine '{}' + ')' ) 38 | 39 | # https://github.com/docker-library/redmine/issues/268 - scanning "files" might be *really* expensive, so we should skip it if it seems like it's "already correct" 40 | local filesOwnerMode 41 | filesOwnerMode="$(stat -c '%U:%a' files)" 42 | if [ "$filesOwnerMode" != 'redmine:755' ]; then 43 | dirs+=( files ) 44 | fi 45 | fi 46 | # directories 755, files 644: 47 | args+=( ${args[@]:+,} '(' -type d '!' -perm 755 -exec sh -c 'chmod 755 "$@" 2>/dev/null || :' -- '{}' + ')' ) 48 | args+=( ${args[@]:+,} '(' -type f '!' -perm 644 -exec sh -c 'chmod 644 "$@" 2>/dev/null || :' -- '{}' + ')' ) 49 | find "${dirs[@]}" "${args[@]}" 50 | } 51 | 52 | # allow the container to be started with `--user` 53 | if [ -n "$isLikelyRedmine" ] && [ "$(id -u)" = '0' ]; then 54 | _fix_permissions 55 | exec gosu redmine "$BASH_SOURCE" "$@" 56 | fi 57 | 58 | if [ -n "$isLikelyRedmine" ]; then 59 | _fix_permissions 60 | if [ ! -f './config/database.yml' ]; then 61 | file_env 'REDMINE_DB_MYSQL' 62 | file_env 'REDMINE_DB_POSTGRES' 63 | file_env 'REDMINE_DB_SQLSERVER' 64 | 65 | if [ "$MYSQL_PORT_3306_TCP" ] && [ -z "$REDMINE_DB_MYSQL" ]; then 66 | export REDMINE_DB_MYSQL='mysql' 67 | elif [ "$POSTGRES_PORT_5432_TCP" ] && [ -z "$REDMINE_DB_POSTGRES" ]; then 68 | export REDMINE_DB_POSTGRES='postgres' 69 | fi 70 | 71 | if [ "$REDMINE_DB_MYSQL" ]; then 72 | adapter='mysql2' 73 | host="$REDMINE_DB_MYSQL" 74 | file_env 'REDMINE_DB_PORT' '3306' 75 | file_env 'REDMINE_DB_USERNAME' "${MYSQL_ENV_MYSQL_USER:-root}" 76 | file_env 'REDMINE_DB_PASSWORD' "${MYSQL_ENV_MYSQL_PASSWORD:-${MYSQL_ENV_MYSQL_ROOT_PASSWORD:-}}" 77 | file_env 'REDMINE_DB_DATABASE' "${MYSQL_ENV_MYSQL_DATABASE:-${MYSQL_ENV_MYSQL_USER:-redmine}}" 78 | file_env 'REDMINE_DB_ENCODING' '' 79 | elif [ "$REDMINE_DB_POSTGRES" ]; then 80 | adapter='postgresql' 81 | host="$REDMINE_DB_POSTGRES" 82 | file_env 'REDMINE_DB_PORT' '5432' 83 | file_env 'REDMINE_DB_USERNAME' "${POSTGRES_ENV_POSTGRES_USER:-postgres}" 84 | file_env 'REDMINE_DB_PASSWORD' "${POSTGRES_ENV_POSTGRES_PASSWORD}" 85 | file_env 'REDMINE_DB_DATABASE' "${POSTGRES_ENV_POSTGRES_DB:-${REDMINE_DB_USERNAME:-}}" 86 | file_env 'REDMINE_DB_ENCODING' 'utf8' 87 | elif [ "$REDMINE_DB_SQLSERVER" ]; then 88 | adapter='sqlserver' 89 | host="$REDMINE_DB_SQLSERVER" 90 | file_env 'REDMINE_DB_PORT' '1433' 91 | file_env 'REDMINE_DB_USERNAME' '' 92 | file_env 'REDMINE_DB_PASSWORD' '' 93 | file_env 'REDMINE_DB_DATABASE' '' 94 | file_env 'REDMINE_DB_ENCODING' '' 95 | else 96 | echo >&2 97 | echo >&2 'warning: missing REDMINE_DB_MYSQL, REDMINE_DB_POSTGRES, or REDMINE_DB_SQLSERVER environment variables' 98 | echo >&2 99 | echo >&2 '*** Using sqlite3 as fallback. ***' 100 | echo >&2 101 | 102 | adapter='sqlite3' 103 | host='localhost' 104 | file_env 'REDMINE_DB_PORT' '' 105 | file_env 'REDMINE_DB_USERNAME' 'redmine' 106 | file_env 'REDMINE_DB_PASSWORD' '' 107 | file_env 'REDMINE_DB_DATABASE' 'sqlite/redmine.db' 108 | file_env 'REDMINE_DB_ENCODING' 'utf8' 109 | 110 | mkdir -p "$(dirname "$REDMINE_DB_DATABASE")" 111 | if [ "$(id -u)" = '0' ]; then 112 | find "$(dirname "$REDMINE_DB_DATABASE")" \! -user redmine -exec chown redmine '{}' + 113 | fi 114 | fi 115 | 116 | REDMINE_DB_ADAPTER="$adapter" 117 | REDMINE_DB_HOST="$host" 118 | echo "$RAILS_ENV:" > config/database.yml 119 | for var in \ 120 | adapter \ 121 | host \ 122 | port \ 123 | username \ 124 | password \ 125 | database \ 126 | encoding \ 127 | ; do 128 | env="REDMINE_DB_${var^^}" 129 | val="${!env}" 130 | [ -n "$val" ] || continue 131 | if [ "$var" != 'adapter' ]; then 132 | # https://github.com/docker-library/redmine/issues/353 🙃 133 | val='"'"$val"'"' 134 | # (only add double quotes to every value *except* `adapter: xxx`) 135 | fi 136 | echo " $var: $val" >> config/database.yml 137 | done 138 | fi 139 | 140 | # install additional gems for Gemfile.local and plugins 141 | bundle check || bundle install 142 | 143 | file_env 'REDMINE_SECRET_KEY_BASE' 144 | # just use the rails variable rather than trying to put it into a yml file 145 | # https://github.com/rails/rails/blob/6-1-stable/railties/lib/rails/application.rb#L438 146 | # https://github.com/rails/rails/blob/1aa9987169213ce5ce43c20b2643bc64c235e792/railties/lib/rails/application.rb#L484 (rails 7.1-stable) 147 | if [ -n "${SECRET_KEY_BASE:-}" ] && [ -n "${REDMINE_SECRET_KEY_BASE:-}" ]; then 148 | echo >&2 149 | echo >&2 'warning: both SECRET_KEY_BASE and REDMINE_SECRET_KEY_BASE{_FILE} set, only SECRET_KEY_BASE will apply' 150 | echo >&2 151 | fi 152 | : "${SECRET_KEY_BASE:=${REDMINE_SECRET_KEY_BASE:-}}" 153 | export SECRET_KEY_BASE 154 | if [ -z "$SECRET_KEY_BASE" ]; then 155 | # https://github.com/docker-library/redmine/issues/397 156 | # empty string is truthy in ruby and so masks the generated fallback config 157 | # https://github.com/rails/rails/blob/1aa9987169213ce5ce43c20b2643bc64c235e792/railties/lib/rails/application.rb#L454 158 | unset SECRET_KEY_BASE 159 | # generate SECRET_KEY_BASE in-file since it is not set or empty; this is not recommended unless the secret_token.rb is saved when container is recreated 160 | if [ ! -f config/initializers/secret_token.rb ]; then 161 | echo >&2 162 | echo >&2 'warning: no *SECRET_KEY_BASE set; running `rake generate_secret_token` to create one in "config/initializers/secret_token.rb"' 163 | echo >&2 164 | rake generate_secret_token 165 | fi 166 | fi 167 | 168 | if [ "$1" != 'rake' -a -z "$REDMINE_NO_DB_MIGRATE" ]; then 169 | rake db:migrate 170 | fi 171 | 172 | if [ "$1" != 'rake' -a -n "$REDMINE_PLUGINS_MIGRATE" ]; then 173 | rake redmine:plugins:migrate 174 | fi 175 | 176 | # remove PID file to enable restarting the container 177 | rm -f tmp/pids/server.pid 178 | fi 179 | 180 | exec "$@" 181 | -------------------------------------------------------------------------------- /5.1/trixie/docker-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -Eeo pipefail 3 | # TODO add "-u" 4 | 5 | # usage: file_env VAR [DEFAULT] 6 | # ie: file_env 'XYZ_DB_PASSWORD' 'example' 7 | # (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of 8 | # "$XYZ_DB_PASSWORD" from a file, especially for Docker's secrets feature) 9 | file_env() { 10 | local var="$1" 11 | local fileVar="${var}_FILE" 12 | local def="${2:-}" 13 | if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then 14 | echo >&2 "error: both $var and $fileVar are set (but are exclusive)" 15 | exit 1 16 | fi 17 | local val="$def" 18 | if [ "${!var:-}" ]; then 19 | val="${!var}" 20 | elif [ "${!fileVar:-}" ]; then 21 | val="$(< "${!fileVar}")" 22 | fi 23 | export "$var"="$val" 24 | unset "$fileVar" 25 | } 26 | 27 | isLikelyRedmine= 28 | case "$1" in 29 | rails | rake ) isLikelyRedmine=1 ;; 30 | bundle ) if [ "${2:-}" = 'exec' ]; then isLikelyRedmine=1; fi ;; # https://github.com/docker-library/redmine/pull/386 - "bundle exec sidekiq" 31 | esac 32 | 33 | _fix_permissions() { 34 | # https://www.redmine.org/projects/redmine/wiki/RedmineInstall#Step-8-File-system-permissions 35 | local dirs=( config log public/*assets tmp ) args=() 36 | if [ "$(id -u)" = '0' ]; then 37 | args+=( ${args[@]:+,} '(' '!' -user redmine -exec chown redmine:redmine '{}' + ')' ) 38 | 39 | # https://github.com/docker-library/redmine/issues/268 - scanning "files" might be *really* expensive, so we should skip it if it seems like it's "already correct" 40 | local filesOwnerMode 41 | filesOwnerMode="$(stat -c '%U:%a' files)" 42 | if [ "$filesOwnerMode" != 'redmine:755' ]; then 43 | dirs+=( files ) 44 | fi 45 | fi 46 | # directories 755, files 644: 47 | args+=( ${args[@]:+,} '(' -type d '!' -perm 755 -exec sh -c 'chmod 755 "$@" 2>/dev/null || :' -- '{}' + ')' ) 48 | args+=( ${args[@]:+,} '(' -type f '!' -perm 644 -exec sh -c 'chmod 644 "$@" 2>/dev/null || :' -- '{}' + ')' ) 49 | find "${dirs[@]}" "${args[@]}" 50 | } 51 | 52 | # allow the container to be started with `--user` 53 | if [ -n "$isLikelyRedmine" ] && [ "$(id -u)" = '0' ]; then 54 | _fix_permissions 55 | exec gosu redmine "$BASH_SOURCE" "$@" 56 | fi 57 | 58 | if [ -n "$isLikelyRedmine" ]; then 59 | _fix_permissions 60 | if [ ! -f './config/database.yml' ]; then 61 | file_env 'REDMINE_DB_MYSQL' 62 | file_env 'REDMINE_DB_POSTGRES' 63 | file_env 'REDMINE_DB_SQLSERVER' 64 | 65 | if [ "$MYSQL_PORT_3306_TCP" ] && [ -z "$REDMINE_DB_MYSQL" ]; then 66 | export REDMINE_DB_MYSQL='mysql' 67 | elif [ "$POSTGRES_PORT_5432_TCP" ] && [ -z "$REDMINE_DB_POSTGRES" ]; then 68 | export REDMINE_DB_POSTGRES='postgres' 69 | fi 70 | 71 | if [ "$REDMINE_DB_MYSQL" ]; then 72 | adapter='mysql2' 73 | host="$REDMINE_DB_MYSQL" 74 | file_env 'REDMINE_DB_PORT' '3306' 75 | file_env 'REDMINE_DB_USERNAME' "${MYSQL_ENV_MYSQL_USER:-root}" 76 | file_env 'REDMINE_DB_PASSWORD' "${MYSQL_ENV_MYSQL_PASSWORD:-${MYSQL_ENV_MYSQL_ROOT_PASSWORD:-}}" 77 | file_env 'REDMINE_DB_DATABASE' "${MYSQL_ENV_MYSQL_DATABASE:-${MYSQL_ENV_MYSQL_USER:-redmine}}" 78 | file_env 'REDMINE_DB_ENCODING' '' 79 | elif [ "$REDMINE_DB_POSTGRES" ]; then 80 | adapter='postgresql' 81 | host="$REDMINE_DB_POSTGRES" 82 | file_env 'REDMINE_DB_PORT' '5432' 83 | file_env 'REDMINE_DB_USERNAME' "${POSTGRES_ENV_POSTGRES_USER:-postgres}" 84 | file_env 'REDMINE_DB_PASSWORD' "${POSTGRES_ENV_POSTGRES_PASSWORD}" 85 | file_env 'REDMINE_DB_DATABASE' "${POSTGRES_ENV_POSTGRES_DB:-${REDMINE_DB_USERNAME:-}}" 86 | file_env 'REDMINE_DB_ENCODING' 'utf8' 87 | elif [ "$REDMINE_DB_SQLSERVER" ]; then 88 | adapter='sqlserver' 89 | host="$REDMINE_DB_SQLSERVER" 90 | file_env 'REDMINE_DB_PORT' '1433' 91 | file_env 'REDMINE_DB_USERNAME' '' 92 | file_env 'REDMINE_DB_PASSWORD' '' 93 | file_env 'REDMINE_DB_DATABASE' '' 94 | file_env 'REDMINE_DB_ENCODING' '' 95 | else 96 | echo >&2 97 | echo >&2 'warning: missing REDMINE_DB_MYSQL, REDMINE_DB_POSTGRES, or REDMINE_DB_SQLSERVER environment variables' 98 | echo >&2 99 | echo >&2 '*** Using sqlite3 as fallback. ***' 100 | echo >&2 101 | 102 | adapter='sqlite3' 103 | host='localhost' 104 | file_env 'REDMINE_DB_PORT' '' 105 | file_env 'REDMINE_DB_USERNAME' 'redmine' 106 | file_env 'REDMINE_DB_PASSWORD' '' 107 | file_env 'REDMINE_DB_DATABASE' 'sqlite/redmine.db' 108 | file_env 'REDMINE_DB_ENCODING' 'utf8' 109 | 110 | mkdir -p "$(dirname "$REDMINE_DB_DATABASE")" 111 | if [ "$(id -u)" = '0' ]; then 112 | find "$(dirname "$REDMINE_DB_DATABASE")" \! -user redmine -exec chown redmine '{}' + 113 | fi 114 | fi 115 | 116 | REDMINE_DB_ADAPTER="$adapter" 117 | REDMINE_DB_HOST="$host" 118 | echo "$RAILS_ENV:" > config/database.yml 119 | for var in \ 120 | adapter \ 121 | host \ 122 | port \ 123 | username \ 124 | password \ 125 | database \ 126 | encoding \ 127 | ; do 128 | env="REDMINE_DB_${var^^}" 129 | val="${!env}" 130 | [ -n "$val" ] || continue 131 | if [ "$var" != 'adapter' ]; then 132 | # https://github.com/docker-library/redmine/issues/353 🙃 133 | val='"'"$val"'"' 134 | # (only add double quotes to every value *except* `adapter: xxx`) 135 | fi 136 | echo " $var: $val" >> config/database.yml 137 | done 138 | fi 139 | 140 | # install additional gems for Gemfile.local and plugins 141 | bundle check || bundle install 142 | 143 | file_env 'REDMINE_SECRET_KEY_BASE' 144 | # just use the rails variable rather than trying to put it into a yml file 145 | # https://github.com/rails/rails/blob/6-1-stable/railties/lib/rails/application.rb#L438 146 | # https://github.com/rails/rails/blob/1aa9987169213ce5ce43c20b2643bc64c235e792/railties/lib/rails/application.rb#L484 (rails 7.1-stable) 147 | if [ -n "${SECRET_KEY_BASE:-}" ] && [ -n "${REDMINE_SECRET_KEY_BASE:-}" ]; then 148 | echo >&2 149 | echo >&2 'warning: both SECRET_KEY_BASE and REDMINE_SECRET_KEY_BASE{_FILE} set, only SECRET_KEY_BASE will apply' 150 | echo >&2 151 | fi 152 | : "${SECRET_KEY_BASE:=${REDMINE_SECRET_KEY_BASE:-}}" 153 | export SECRET_KEY_BASE 154 | if [ -z "$SECRET_KEY_BASE" ]; then 155 | # https://github.com/docker-library/redmine/issues/397 156 | # empty string is truthy in ruby and so masks the generated fallback config 157 | # https://github.com/rails/rails/blob/1aa9987169213ce5ce43c20b2643bc64c235e792/railties/lib/rails/application.rb#L454 158 | unset SECRET_KEY_BASE 159 | # generate SECRET_KEY_BASE in-file since it is not set or empty; this is not recommended unless the secret_token.rb is saved when container is recreated 160 | if [ ! -f config/initializers/secret_token.rb ]; then 161 | echo >&2 162 | echo >&2 'warning: no *SECRET_KEY_BASE set; running `rake generate_secret_token` to create one in "config/initializers/secret_token.rb"' 163 | echo >&2 164 | rake generate_secret_token 165 | fi 166 | fi 167 | 168 | if [ "$1" != 'rake' -a -z "$REDMINE_NO_DB_MIGRATE" ]; then 169 | rake db:migrate 170 | fi 171 | 172 | if [ "$1" != 'rake' -a -n "$REDMINE_PLUGINS_MIGRATE" ]; then 173 | rake redmine:plugins:migrate 174 | fi 175 | 176 | # remove PID file to enable restarting the container 177 | rm -f tmp/pids/server.pid 178 | fi 179 | 180 | exec "$@" 181 | -------------------------------------------------------------------------------- /6.0/trixie/docker-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -Eeo pipefail 3 | # TODO add "-u" 4 | 5 | # usage: file_env VAR [DEFAULT] 6 | # ie: file_env 'XYZ_DB_PASSWORD' 'example' 7 | # (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of 8 | # "$XYZ_DB_PASSWORD" from a file, especially for Docker's secrets feature) 9 | file_env() { 10 | local var="$1" 11 | local fileVar="${var}_FILE" 12 | local def="${2:-}" 13 | if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then 14 | echo >&2 "error: both $var and $fileVar are set (but are exclusive)" 15 | exit 1 16 | fi 17 | local val="$def" 18 | if [ "${!var:-}" ]; then 19 | val="${!var}" 20 | elif [ "${!fileVar:-}" ]; then 21 | val="$(< "${!fileVar}")" 22 | fi 23 | export "$var"="$val" 24 | unset "$fileVar" 25 | } 26 | 27 | isLikelyRedmine= 28 | case "$1" in 29 | rails | rake ) isLikelyRedmine=1 ;; 30 | bundle ) if [ "${2:-}" = 'exec' ]; then isLikelyRedmine=1; fi ;; # https://github.com/docker-library/redmine/pull/386 - "bundle exec sidekiq" 31 | esac 32 | 33 | _fix_permissions() { 34 | # https://www.redmine.org/projects/redmine/wiki/RedmineInstall#Step-8-File-system-permissions 35 | local dirs=( config log public/*assets tmp ) args=() 36 | if [ "$(id -u)" = '0' ]; then 37 | args+=( ${args[@]:+,} '(' '!' -user redmine -exec chown redmine:redmine '{}' + ')' ) 38 | 39 | # https://github.com/docker-library/redmine/issues/268 - scanning "files" might be *really* expensive, so we should skip it if it seems like it's "already correct" 40 | local filesOwnerMode 41 | filesOwnerMode="$(stat -c '%U:%a' files)" 42 | if [ "$filesOwnerMode" != 'redmine:755' ]; then 43 | dirs+=( files ) 44 | fi 45 | fi 46 | # directories 755, files 644: 47 | args+=( ${args[@]:+,} '(' -type d '!' -perm 755 -exec sh -c 'chmod 755 "$@" 2>/dev/null || :' -- '{}' + ')' ) 48 | args+=( ${args[@]:+,} '(' -type f '!' -perm 644 -exec sh -c 'chmod 644 "$@" 2>/dev/null || :' -- '{}' + ')' ) 49 | find "${dirs[@]}" "${args[@]}" 50 | } 51 | 52 | # allow the container to be started with `--user` 53 | if [ -n "$isLikelyRedmine" ] && [ "$(id -u)" = '0' ]; then 54 | _fix_permissions 55 | exec gosu redmine "$BASH_SOURCE" "$@" 56 | fi 57 | 58 | if [ -n "$isLikelyRedmine" ]; then 59 | _fix_permissions 60 | if [ ! -f './config/database.yml' ]; then 61 | file_env 'REDMINE_DB_MYSQL' 62 | file_env 'REDMINE_DB_POSTGRES' 63 | file_env 'REDMINE_DB_SQLSERVER' 64 | 65 | if [ "$MYSQL_PORT_3306_TCP" ] && [ -z "$REDMINE_DB_MYSQL" ]; then 66 | export REDMINE_DB_MYSQL='mysql' 67 | elif [ "$POSTGRES_PORT_5432_TCP" ] && [ -z "$REDMINE_DB_POSTGRES" ]; then 68 | export REDMINE_DB_POSTGRES='postgres' 69 | fi 70 | 71 | if [ "$REDMINE_DB_MYSQL" ]; then 72 | adapter='mysql2' 73 | host="$REDMINE_DB_MYSQL" 74 | file_env 'REDMINE_DB_PORT' '3306' 75 | file_env 'REDMINE_DB_USERNAME' "${MYSQL_ENV_MYSQL_USER:-root}" 76 | file_env 'REDMINE_DB_PASSWORD' "${MYSQL_ENV_MYSQL_PASSWORD:-${MYSQL_ENV_MYSQL_ROOT_PASSWORD:-}}" 77 | file_env 'REDMINE_DB_DATABASE' "${MYSQL_ENV_MYSQL_DATABASE:-${MYSQL_ENV_MYSQL_USER:-redmine}}" 78 | file_env 'REDMINE_DB_ENCODING' '' 79 | elif [ "$REDMINE_DB_POSTGRES" ]; then 80 | adapter='postgresql' 81 | host="$REDMINE_DB_POSTGRES" 82 | file_env 'REDMINE_DB_PORT' '5432' 83 | file_env 'REDMINE_DB_USERNAME' "${POSTGRES_ENV_POSTGRES_USER:-postgres}" 84 | file_env 'REDMINE_DB_PASSWORD' "${POSTGRES_ENV_POSTGRES_PASSWORD}" 85 | file_env 'REDMINE_DB_DATABASE' "${POSTGRES_ENV_POSTGRES_DB:-${REDMINE_DB_USERNAME:-}}" 86 | file_env 'REDMINE_DB_ENCODING' 'utf8' 87 | elif [ "$REDMINE_DB_SQLSERVER" ]; then 88 | adapter='sqlserver' 89 | host="$REDMINE_DB_SQLSERVER" 90 | file_env 'REDMINE_DB_PORT' '1433' 91 | file_env 'REDMINE_DB_USERNAME' '' 92 | file_env 'REDMINE_DB_PASSWORD' '' 93 | file_env 'REDMINE_DB_DATABASE' '' 94 | file_env 'REDMINE_DB_ENCODING' '' 95 | else 96 | echo >&2 97 | echo >&2 'warning: missing REDMINE_DB_MYSQL, REDMINE_DB_POSTGRES, or REDMINE_DB_SQLSERVER environment variables' 98 | echo >&2 99 | echo >&2 '*** Using sqlite3 as fallback. ***' 100 | echo >&2 101 | 102 | adapter='sqlite3' 103 | host='localhost' 104 | file_env 'REDMINE_DB_PORT' '' 105 | file_env 'REDMINE_DB_USERNAME' 'redmine' 106 | file_env 'REDMINE_DB_PASSWORD' '' 107 | file_env 'REDMINE_DB_DATABASE' 'sqlite/redmine.db' 108 | file_env 'REDMINE_DB_ENCODING' 'utf8' 109 | 110 | mkdir -p "$(dirname "$REDMINE_DB_DATABASE")" 111 | if [ "$(id -u)" = '0' ]; then 112 | find "$(dirname "$REDMINE_DB_DATABASE")" \! -user redmine -exec chown redmine '{}' + 113 | fi 114 | fi 115 | 116 | REDMINE_DB_ADAPTER="$adapter" 117 | REDMINE_DB_HOST="$host" 118 | echo "$RAILS_ENV:" > config/database.yml 119 | for var in \ 120 | adapter \ 121 | host \ 122 | port \ 123 | username \ 124 | password \ 125 | database \ 126 | encoding \ 127 | ; do 128 | env="REDMINE_DB_${var^^}" 129 | val="${!env}" 130 | [ -n "$val" ] || continue 131 | if [ "$var" != 'adapter' ]; then 132 | # https://github.com/docker-library/redmine/issues/353 🙃 133 | val='"'"$val"'"' 134 | # (only add double quotes to every value *except* `adapter: xxx`) 135 | fi 136 | echo " $var: $val" >> config/database.yml 137 | done 138 | fi 139 | 140 | # install additional gems for Gemfile.local and plugins 141 | bundle check || bundle install 142 | 143 | file_env 'REDMINE_SECRET_KEY_BASE' 144 | # just use the rails variable rather than trying to put it into a yml file 145 | # https://github.com/rails/rails/blob/6-1-stable/railties/lib/rails/application.rb#L438 146 | # https://github.com/rails/rails/blob/1aa9987169213ce5ce43c20b2643bc64c235e792/railties/lib/rails/application.rb#L484 (rails 7.1-stable) 147 | if [ -n "${SECRET_KEY_BASE:-}" ] && [ -n "${REDMINE_SECRET_KEY_BASE:-}" ]; then 148 | echo >&2 149 | echo >&2 'warning: both SECRET_KEY_BASE and REDMINE_SECRET_KEY_BASE{_FILE} set, only SECRET_KEY_BASE will apply' 150 | echo >&2 151 | fi 152 | : "${SECRET_KEY_BASE:=${REDMINE_SECRET_KEY_BASE:-}}" 153 | export SECRET_KEY_BASE 154 | if [ -z "$SECRET_KEY_BASE" ]; then 155 | # https://github.com/docker-library/redmine/issues/397 156 | # empty string is truthy in ruby and so masks the generated fallback config 157 | # https://github.com/rails/rails/blob/1aa9987169213ce5ce43c20b2643bc64c235e792/railties/lib/rails/application.rb#L454 158 | unset SECRET_KEY_BASE 159 | # generate SECRET_KEY_BASE in-file since it is not set or empty; this is not recommended unless the secret_token.rb is saved when container is recreated 160 | if [ ! -f config/initializers/secret_token.rb ]; then 161 | echo >&2 162 | echo >&2 'warning: no *SECRET_KEY_BASE set; running `rake generate_secret_token` to create one in "config/initializers/secret_token.rb"' 163 | echo >&2 164 | rake generate_secret_token 165 | fi 166 | fi 167 | 168 | if [ "$1" != 'rake' -a -z "$REDMINE_NO_DB_MIGRATE" ]; then 169 | rake db:migrate 170 | fi 171 | 172 | if [ "$1" != 'rake' -a -n "$REDMINE_PLUGINS_MIGRATE" ]; then 173 | rake redmine:plugins:migrate 174 | fi 175 | 176 | # remove PID file to enable restarting the container 177 | rm -f tmp/pids/server.pid 178 | fi 179 | 180 | exec "$@" 181 | -------------------------------------------------------------------------------- /6.1/trixie/docker-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -Eeo pipefail 3 | # TODO add "-u" 4 | 5 | # usage: file_env VAR [DEFAULT] 6 | # ie: file_env 'XYZ_DB_PASSWORD' 'example' 7 | # (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of 8 | # "$XYZ_DB_PASSWORD" from a file, especially for Docker's secrets feature) 9 | file_env() { 10 | local var="$1" 11 | local fileVar="${var}_FILE" 12 | local def="${2:-}" 13 | if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then 14 | echo >&2 "error: both $var and $fileVar are set (but are exclusive)" 15 | exit 1 16 | fi 17 | local val="$def" 18 | if [ "${!var:-}" ]; then 19 | val="${!var}" 20 | elif [ "${!fileVar:-}" ]; then 21 | val="$(< "${!fileVar}")" 22 | fi 23 | export "$var"="$val" 24 | unset "$fileVar" 25 | } 26 | 27 | isLikelyRedmine= 28 | case "$1" in 29 | rails | rake ) isLikelyRedmine=1 ;; 30 | bundle ) if [ "${2:-}" = 'exec' ]; then isLikelyRedmine=1; fi ;; # https://github.com/docker-library/redmine/pull/386 - "bundle exec sidekiq" 31 | esac 32 | 33 | _fix_permissions() { 34 | # https://www.redmine.org/projects/redmine/wiki/RedmineInstall#Step-8-File-system-permissions 35 | local dirs=( config log public/*assets tmp ) args=() 36 | if [ "$(id -u)" = '0' ]; then 37 | args+=( ${args[@]:+,} '(' '!' -user redmine -exec chown redmine:redmine '{}' + ')' ) 38 | 39 | # https://github.com/docker-library/redmine/issues/268 - scanning "files" might be *really* expensive, so we should skip it if it seems like it's "already correct" 40 | local filesOwnerMode 41 | filesOwnerMode="$(stat -c '%U:%a' files)" 42 | if [ "$filesOwnerMode" != 'redmine:755' ]; then 43 | dirs+=( files ) 44 | fi 45 | fi 46 | # directories 755, files 644: 47 | args+=( ${args[@]:+,} '(' -type d '!' -perm 755 -exec sh -c 'chmod 755 "$@" 2>/dev/null || :' -- '{}' + ')' ) 48 | args+=( ${args[@]:+,} '(' -type f '!' -perm 644 -exec sh -c 'chmod 644 "$@" 2>/dev/null || :' -- '{}' + ')' ) 49 | find "${dirs[@]}" "${args[@]}" 50 | } 51 | 52 | # allow the container to be started with `--user` 53 | if [ -n "$isLikelyRedmine" ] && [ "$(id -u)" = '0' ]; then 54 | _fix_permissions 55 | exec gosu redmine "$BASH_SOURCE" "$@" 56 | fi 57 | 58 | if [ -n "$isLikelyRedmine" ]; then 59 | _fix_permissions 60 | if [ ! -f './config/database.yml' ]; then 61 | file_env 'REDMINE_DB_MYSQL' 62 | file_env 'REDMINE_DB_POSTGRES' 63 | file_env 'REDMINE_DB_SQLSERVER' 64 | 65 | if [ "$MYSQL_PORT_3306_TCP" ] && [ -z "$REDMINE_DB_MYSQL" ]; then 66 | export REDMINE_DB_MYSQL='mysql' 67 | elif [ "$POSTGRES_PORT_5432_TCP" ] && [ -z "$REDMINE_DB_POSTGRES" ]; then 68 | export REDMINE_DB_POSTGRES='postgres' 69 | fi 70 | 71 | if [ "$REDMINE_DB_MYSQL" ]; then 72 | adapter='mysql2' 73 | host="$REDMINE_DB_MYSQL" 74 | file_env 'REDMINE_DB_PORT' '3306' 75 | file_env 'REDMINE_DB_USERNAME' "${MYSQL_ENV_MYSQL_USER:-root}" 76 | file_env 'REDMINE_DB_PASSWORD' "${MYSQL_ENV_MYSQL_PASSWORD:-${MYSQL_ENV_MYSQL_ROOT_PASSWORD:-}}" 77 | file_env 'REDMINE_DB_DATABASE' "${MYSQL_ENV_MYSQL_DATABASE:-${MYSQL_ENV_MYSQL_USER:-redmine}}" 78 | file_env 'REDMINE_DB_ENCODING' '' 79 | elif [ "$REDMINE_DB_POSTGRES" ]; then 80 | adapter='postgresql' 81 | host="$REDMINE_DB_POSTGRES" 82 | file_env 'REDMINE_DB_PORT' '5432' 83 | file_env 'REDMINE_DB_USERNAME' "${POSTGRES_ENV_POSTGRES_USER:-postgres}" 84 | file_env 'REDMINE_DB_PASSWORD' "${POSTGRES_ENV_POSTGRES_PASSWORD}" 85 | file_env 'REDMINE_DB_DATABASE' "${POSTGRES_ENV_POSTGRES_DB:-${REDMINE_DB_USERNAME:-}}" 86 | file_env 'REDMINE_DB_ENCODING' 'utf8' 87 | elif [ "$REDMINE_DB_SQLSERVER" ]; then 88 | adapter='sqlserver' 89 | host="$REDMINE_DB_SQLSERVER" 90 | file_env 'REDMINE_DB_PORT' '1433' 91 | file_env 'REDMINE_DB_USERNAME' '' 92 | file_env 'REDMINE_DB_PASSWORD' '' 93 | file_env 'REDMINE_DB_DATABASE' '' 94 | file_env 'REDMINE_DB_ENCODING' '' 95 | else 96 | echo >&2 97 | echo >&2 'warning: missing REDMINE_DB_MYSQL, REDMINE_DB_POSTGRES, or REDMINE_DB_SQLSERVER environment variables' 98 | echo >&2 99 | echo >&2 '*** Using sqlite3 as fallback. ***' 100 | echo >&2 101 | 102 | adapter='sqlite3' 103 | host='localhost' 104 | file_env 'REDMINE_DB_PORT' '' 105 | file_env 'REDMINE_DB_USERNAME' 'redmine' 106 | file_env 'REDMINE_DB_PASSWORD' '' 107 | file_env 'REDMINE_DB_DATABASE' 'sqlite/redmine.db' 108 | file_env 'REDMINE_DB_ENCODING' 'utf8' 109 | 110 | mkdir -p "$(dirname "$REDMINE_DB_DATABASE")" 111 | if [ "$(id -u)" = '0' ]; then 112 | find "$(dirname "$REDMINE_DB_DATABASE")" \! -user redmine -exec chown redmine '{}' + 113 | fi 114 | fi 115 | 116 | REDMINE_DB_ADAPTER="$adapter" 117 | REDMINE_DB_HOST="$host" 118 | echo "$RAILS_ENV:" > config/database.yml 119 | for var in \ 120 | adapter \ 121 | host \ 122 | port \ 123 | username \ 124 | password \ 125 | database \ 126 | encoding \ 127 | ; do 128 | env="REDMINE_DB_${var^^}" 129 | val="${!env}" 130 | [ -n "$val" ] || continue 131 | if [ "$var" != 'adapter' ]; then 132 | # https://github.com/docker-library/redmine/issues/353 🙃 133 | val='"'"$val"'"' 134 | # (only add double quotes to every value *except* `adapter: xxx`) 135 | fi 136 | echo " $var: $val" >> config/database.yml 137 | done 138 | fi 139 | 140 | # install additional gems for Gemfile.local and plugins 141 | bundle check || bundle install 142 | 143 | file_env 'REDMINE_SECRET_KEY_BASE' 144 | # just use the rails variable rather than trying to put it into a yml file 145 | # https://github.com/rails/rails/blob/6-1-stable/railties/lib/rails/application.rb#L438 146 | # https://github.com/rails/rails/blob/1aa9987169213ce5ce43c20b2643bc64c235e792/railties/lib/rails/application.rb#L484 (rails 7.1-stable) 147 | if [ -n "${SECRET_KEY_BASE:-}" ] && [ -n "${REDMINE_SECRET_KEY_BASE:-}" ]; then 148 | echo >&2 149 | echo >&2 'warning: both SECRET_KEY_BASE and REDMINE_SECRET_KEY_BASE{_FILE} set, only SECRET_KEY_BASE will apply' 150 | echo >&2 151 | fi 152 | : "${SECRET_KEY_BASE:=${REDMINE_SECRET_KEY_BASE:-}}" 153 | export SECRET_KEY_BASE 154 | if [ -z "$SECRET_KEY_BASE" ]; then 155 | # https://github.com/docker-library/redmine/issues/397 156 | # empty string is truthy in ruby and so masks the generated fallback config 157 | # https://github.com/rails/rails/blob/1aa9987169213ce5ce43c20b2643bc64c235e792/railties/lib/rails/application.rb#L454 158 | unset SECRET_KEY_BASE 159 | # generate SECRET_KEY_BASE in-file since it is not set or empty; this is not recommended unless the secret_token.rb is saved when container is recreated 160 | if [ ! -f config/initializers/secret_token.rb ]; then 161 | echo >&2 162 | echo >&2 'warning: no *SECRET_KEY_BASE set; running `rake generate_secret_token` to create one in "config/initializers/secret_token.rb"' 163 | echo >&2 164 | rake generate_secret_token 165 | fi 166 | fi 167 | 168 | if [ "$1" != 'rake' -a -z "$REDMINE_NO_DB_MIGRATE" ]; then 169 | rake db:migrate 170 | fi 171 | 172 | if [ "$1" != 'rake' -a -n "$REDMINE_PLUGINS_MIGRATE" ]; then 173 | rake redmine:plugins:migrate 174 | fi 175 | 176 | # remove PID file to enable restarting the container 177 | rm -f tmp/pids/server.pid 178 | fi 179 | 180 | exec "$@" 181 | -------------------------------------------------------------------------------- /5.1/alpine3.22/docker-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -Eeo pipefail 3 | # TODO add "-u" 4 | 5 | # usage: file_env VAR [DEFAULT] 6 | # ie: file_env 'XYZ_DB_PASSWORD' 'example' 7 | # (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of 8 | # "$XYZ_DB_PASSWORD" from a file, especially for Docker's secrets feature) 9 | file_env() { 10 | local var="$1" 11 | local fileVar="${var}_FILE" 12 | local def="${2:-}" 13 | if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then 14 | echo >&2 "error: both $var and $fileVar are set (but are exclusive)" 15 | exit 1 16 | fi 17 | local val="$def" 18 | if [ "${!var:-}" ]; then 19 | val="${!var}" 20 | elif [ "${!fileVar:-}" ]; then 21 | val="$(< "${!fileVar}")" 22 | fi 23 | export "$var"="$val" 24 | unset "$fileVar" 25 | } 26 | 27 | isLikelyRedmine= 28 | case "$1" in 29 | rails | rake ) isLikelyRedmine=1 ;; 30 | bundle ) if [ "${2:-}" = 'exec' ]; then isLikelyRedmine=1; fi ;; # https://github.com/docker-library/redmine/pull/386 - "bundle exec sidekiq" 31 | esac 32 | 33 | _fix_permissions() { 34 | # https://www.redmine.org/projects/redmine/wiki/RedmineInstall#Step-8-File-system-permissions 35 | local dirs=( config log public/*assets tmp ) args=() 36 | if [ "$(id -u)" = '0' ]; then 37 | args+=( ${args[@]:+,} '(' '!' -user redmine -exec chown redmine:redmine '{}' + ')' ) 38 | 39 | # https://github.com/docker-library/redmine/issues/268 - scanning "files" might be *really* expensive, so we should skip it if it seems like it's "already correct" 40 | local filesOwnerMode 41 | filesOwnerMode="$(stat -c '%U:%a' files)" 42 | if [ "$filesOwnerMode" != 'redmine:755' ]; then 43 | dirs+=( files ) 44 | fi 45 | fi 46 | # directories 755, files 644: 47 | args+=( ${args[@]:+,} '(' -type d '!' -perm 755 -exec sh -c 'chmod 755 "$@" 2>/dev/null || :' -- '{}' + ')' ) 48 | args+=( ${args[@]:+,} '(' -type f '!' -perm 644 -exec sh -c 'chmod 644 "$@" 2>/dev/null || :' -- '{}' + ')' ) 49 | find "${dirs[@]}" "${args[@]}" 50 | } 51 | 52 | # allow the container to be started with `--user` 53 | if [ -n "$isLikelyRedmine" ] && [ "$(id -u)" = '0' ]; then 54 | _fix_permissions 55 | exec gosu redmine "$BASH_SOURCE" "$@" 56 | fi 57 | 58 | if [ -n "$isLikelyRedmine" ]; then 59 | _fix_permissions 60 | if [ ! -f './config/database.yml' ]; then 61 | file_env 'REDMINE_DB_MYSQL' 62 | file_env 'REDMINE_DB_POSTGRES' 63 | file_env 'REDMINE_DB_SQLSERVER' 64 | 65 | if [ "$MYSQL_PORT_3306_TCP" ] && [ -z "$REDMINE_DB_MYSQL" ]; then 66 | export REDMINE_DB_MYSQL='mysql' 67 | elif [ "$POSTGRES_PORT_5432_TCP" ] && [ -z "$REDMINE_DB_POSTGRES" ]; then 68 | export REDMINE_DB_POSTGRES='postgres' 69 | fi 70 | 71 | if [ "$REDMINE_DB_MYSQL" ]; then 72 | adapter='mysql2' 73 | host="$REDMINE_DB_MYSQL" 74 | file_env 'REDMINE_DB_PORT' '3306' 75 | file_env 'REDMINE_DB_USERNAME' "${MYSQL_ENV_MYSQL_USER:-root}" 76 | file_env 'REDMINE_DB_PASSWORD' "${MYSQL_ENV_MYSQL_PASSWORD:-${MYSQL_ENV_MYSQL_ROOT_PASSWORD:-}}" 77 | file_env 'REDMINE_DB_DATABASE' "${MYSQL_ENV_MYSQL_DATABASE:-${MYSQL_ENV_MYSQL_USER:-redmine}}" 78 | file_env 'REDMINE_DB_ENCODING' '' 79 | elif [ "$REDMINE_DB_POSTGRES" ]; then 80 | adapter='postgresql' 81 | host="$REDMINE_DB_POSTGRES" 82 | file_env 'REDMINE_DB_PORT' '5432' 83 | file_env 'REDMINE_DB_USERNAME' "${POSTGRES_ENV_POSTGRES_USER:-postgres}" 84 | file_env 'REDMINE_DB_PASSWORD' "${POSTGRES_ENV_POSTGRES_PASSWORD}" 85 | file_env 'REDMINE_DB_DATABASE' "${POSTGRES_ENV_POSTGRES_DB:-${REDMINE_DB_USERNAME:-}}" 86 | file_env 'REDMINE_DB_ENCODING' 'utf8' 87 | elif [ "$REDMINE_DB_SQLSERVER" ]; then 88 | adapter='sqlserver' 89 | host="$REDMINE_DB_SQLSERVER" 90 | file_env 'REDMINE_DB_PORT' '1433' 91 | file_env 'REDMINE_DB_USERNAME' '' 92 | file_env 'REDMINE_DB_PASSWORD' '' 93 | file_env 'REDMINE_DB_DATABASE' '' 94 | file_env 'REDMINE_DB_ENCODING' '' 95 | else 96 | echo >&2 97 | echo >&2 'warning: missing REDMINE_DB_MYSQL, REDMINE_DB_POSTGRES, or REDMINE_DB_SQLSERVER environment variables' 98 | echo >&2 99 | echo >&2 '*** Using sqlite3 as fallback. ***' 100 | echo >&2 101 | 102 | adapter='sqlite3' 103 | host='localhost' 104 | file_env 'REDMINE_DB_PORT' '' 105 | file_env 'REDMINE_DB_USERNAME' 'redmine' 106 | file_env 'REDMINE_DB_PASSWORD' '' 107 | file_env 'REDMINE_DB_DATABASE' 'sqlite/redmine.db' 108 | file_env 'REDMINE_DB_ENCODING' 'utf8' 109 | 110 | mkdir -p "$(dirname "$REDMINE_DB_DATABASE")" 111 | if [ "$(id -u)" = '0' ]; then 112 | find "$(dirname "$REDMINE_DB_DATABASE")" \! -user redmine -exec chown redmine '{}' + 113 | fi 114 | fi 115 | 116 | REDMINE_DB_ADAPTER="$adapter" 117 | REDMINE_DB_HOST="$host" 118 | echo "$RAILS_ENV:" > config/database.yml 119 | for var in \ 120 | adapter \ 121 | host \ 122 | port \ 123 | username \ 124 | password \ 125 | database \ 126 | encoding \ 127 | ; do 128 | env="REDMINE_DB_${var^^}" 129 | val="${!env}" 130 | [ -n "$val" ] || continue 131 | if [ "$var" != 'adapter' ]; then 132 | # https://github.com/docker-library/redmine/issues/353 🙃 133 | val='"'"$val"'"' 134 | # (only add double quotes to every value *except* `adapter: xxx`) 135 | fi 136 | echo " $var: $val" >> config/database.yml 137 | done 138 | fi 139 | 140 | # install additional gems for Gemfile.local and plugins 141 | bundle check || bundle install 142 | 143 | file_env 'REDMINE_SECRET_KEY_BASE' 144 | # just use the rails variable rather than trying to put it into a yml file 145 | # https://github.com/rails/rails/blob/6-1-stable/railties/lib/rails/application.rb#L438 146 | # https://github.com/rails/rails/blob/1aa9987169213ce5ce43c20b2643bc64c235e792/railties/lib/rails/application.rb#L484 (rails 7.1-stable) 147 | if [ -n "${SECRET_KEY_BASE:-}" ] && [ -n "${REDMINE_SECRET_KEY_BASE:-}" ]; then 148 | echo >&2 149 | echo >&2 'warning: both SECRET_KEY_BASE and REDMINE_SECRET_KEY_BASE{_FILE} set, only SECRET_KEY_BASE will apply' 150 | echo >&2 151 | fi 152 | : "${SECRET_KEY_BASE:=${REDMINE_SECRET_KEY_BASE:-}}" 153 | export SECRET_KEY_BASE 154 | if [ -z "$SECRET_KEY_BASE" ]; then 155 | # https://github.com/docker-library/redmine/issues/397 156 | # empty string is truthy in ruby and so masks the generated fallback config 157 | # https://github.com/rails/rails/blob/1aa9987169213ce5ce43c20b2643bc64c235e792/railties/lib/rails/application.rb#L454 158 | unset SECRET_KEY_BASE 159 | # generate SECRET_KEY_BASE in-file since it is not set or empty; this is not recommended unless the secret_token.rb is saved when container is recreated 160 | if [ ! -f config/initializers/secret_token.rb ]; then 161 | echo >&2 162 | echo >&2 'warning: no *SECRET_KEY_BASE set; running `rake generate_secret_token` to create one in "config/initializers/secret_token.rb"' 163 | echo >&2 164 | rake generate_secret_token 165 | fi 166 | fi 167 | 168 | if [ "$1" != 'rake' -a -z "$REDMINE_NO_DB_MIGRATE" ]; then 169 | rake db:migrate 170 | fi 171 | 172 | if [ "$1" != 'rake' -a -n "$REDMINE_PLUGINS_MIGRATE" ]; then 173 | rake redmine:plugins:migrate 174 | fi 175 | 176 | # remove PID file to enable restarting the container 177 | rm -f tmp/pids/server.pid 178 | fi 179 | 180 | exec "$@" 181 | -------------------------------------------------------------------------------- /5.1/alpine3.23/docker-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -Eeo pipefail 3 | # TODO add "-u" 4 | 5 | # usage: file_env VAR [DEFAULT] 6 | # ie: file_env 'XYZ_DB_PASSWORD' 'example' 7 | # (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of 8 | # "$XYZ_DB_PASSWORD" from a file, especially for Docker's secrets feature) 9 | file_env() { 10 | local var="$1" 11 | local fileVar="${var}_FILE" 12 | local def="${2:-}" 13 | if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then 14 | echo >&2 "error: both $var and $fileVar are set (but are exclusive)" 15 | exit 1 16 | fi 17 | local val="$def" 18 | if [ "${!var:-}" ]; then 19 | val="${!var}" 20 | elif [ "${!fileVar:-}" ]; then 21 | val="$(< "${!fileVar}")" 22 | fi 23 | export "$var"="$val" 24 | unset "$fileVar" 25 | } 26 | 27 | isLikelyRedmine= 28 | case "$1" in 29 | rails | rake ) isLikelyRedmine=1 ;; 30 | bundle ) if [ "${2:-}" = 'exec' ]; then isLikelyRedmine=1; fi ;; # https://github.com/docker-library/redmine/pull/386 - "bundle exec sidekiq" 31 | esac 32 | 33 | _fix_permissions() { 34 | # https://www.redmine.org/projects/redmine/wiki/RedmineInstall#Step-8-File-system-permissions 35 | local dirs=( config log public/*assets tmp ) args=() 36 | if [ "$(id -u)" = '0' ]; then 37 | args+=( ${args[@]:+,} '(' '!' -user redmine -exec chown redmine:redmine '{}' + ')' ) 38 | 39 | # https://github.com/docker-library/redmine/issues/268 - scanning "files" might be *really* expensive, so we should skip it if it seems like it's "already correct" 40 | local filesOwnerMode 41 | filesOwnerMode="$(stat -c '%U:%a' files)" 42 | if [ "$filesOwnerMode" != 'redmine:755' ]; then 43 | dirs+=( files ) 44 | fi 45 | fi 46 | # directories 755, files 644: 47 | args+=( ${args[@]:+,} '(' -type d '!' -perm 755 -exec sh -c 'chmod 755 "$@" 2>/dev/null || :' -- '{}' + ')' ) 48 | args+=( ${args[@]:+,} '(' -type f '!' -perm 644 -exec sh -c 'chmod 644 "$@" 2>/dev/null || :' -- '{}' + ')' ) 49 | find "${dirs[@]}" "${args[@]}" 50 | } 51 | 52 | # allow the container to be started with `--user` 53 | if [ -n "$isLikelyRedmine" ] && [ "$(id -u)" = '0' ]; then 54 | _fix_permissions 55 | exec gosu redmine "$BASH_SOURCE" "$@" 56 | fi 57 | 58 | if [ -n "$isLikelyRedmine" ]; then 59 | _fix_permissions 60 | if [ ! -f './config/database.yml' ]; then 61 | file_env 'REDMINE_DB_MYSQL' 62 | file_env 'REDMINE_DB_POSTGRES' 63 | file_env 'REDMINE_DB_SQLSERVER' 64 | 65 | if [ "$MYSQL_PORT_3306_TCP" ] && [ -z "$REDMINE_DB_MYSQL" ]; then 66 | export REDMINE_DB_MYSQL='mysql' 67 | elif [ "$POSTGRES_PORT_5432_TCP" ] && [ -z "$REDMINE_DB_POSTGRES" ]; then 68 | export REDMINE_DB_POSTGRES='postgres' 69 | fi 70 | 71 | if [ "$REDMINE_DB_MYSQL" ]; then 72 | adapter='mysql2' 73 | host="$REDMINE_DB_MYSQL" 74 | file_env 'REDMINE_DB_PORT' '3306' 75 | file_env 'REDMINE_DB_USERNAME' "${MYSQL_ENV_MYSQL_USER:-root}" 76 | file_env 'REDMINE_DB_PASSWORD' "${MYSQL_ENV_MYSQL_PASSWORD:-${MYSQL_ENV_MYSQL_ROOT_PASSWORD:-}}" 77 | file_env 'REDMINE_DB_DATABASE' "${MYSQL_ENV_MYSQL_DATABASE:-${MYSQL_ENV_MYSQL_USER:-redmine}}" 78 | file_env 'REDMINE_DB_ENCODING' '' 79 | elif [ "$REDMINE_DB_POSTGRES" ]; then 80 | adapter='postgresql' 81 | host="$REDMINE_DB_POSTGRES" 82 | file_env 'REDMINE_DB_PORT' '5432' 83 | file_env 'REDMINE_DB_USERNAME' "${POSTGRES_ENV_POSTGRES_USER:-postgres}" 84 | file_env 'REDMINE_DB_PASSWORD' "${POSTGRES_ENV_POSTGRES_PASSWORD}" 85 | file_env 'REDMINE_DB_DATABASE' "${POSTGRES_ENV_POSTGRES_DB:-${REDMINE_DB_USERNAME:-}}" 86 | file_env 'REDMINE_DB_ENCODING' 'utf8' 87 | elif [ "$REDMINE_DB_SQLSERVER" ]; then 88 | adapter='sqlserver' 89 | host="$REDMINE_DB_SQLSERVER" 90 | file_env 'REDMINE_DB_PORT' '1433' 91 | file_env 'REDMINE_DB_USERNAME' '' 92 | file_env 'REDMINE_DB_PASSWORD' '' 93 | file_env 'REDMINE_DB_DATABASE' '' 94 | file_env 'REDMINE_DB_ENCODING' '' 95 | else 96 | echo >&2 97 | echo >&2 'warning: missing REDMINE_DB_MYSQL, REDMINE_DB_POSTGRES, or REDMINE_DB_SQLSERVER environment variables' 98 | echo >&2 99 | echo >&2 '*** Using sqlite3 as fallback. ***' 100 | echo >&2 101 | 102 | adapter='sqlite3' 103 | host='localhost' 104 | file_env 'REDMINE_DB_PORT' '' 105 | file_env 'REDMINE_DB_USERNAME' 'redmine' 106 | file_env 'REDMINE_DB_PASSWORD' '' 107 | file_env 'REDMINE_DB_DATABASE' 'sqlite/redmine.db' 108 | file_env 'REDMINE_DB_ENCODING' 'utf8' 109 | 110 | mkdir -p "$(dirname "$REDMINE_DB_DATABASE")" 111 | if [ "$(id -u)" = '0' ]; then 112 | find "$(dirname "$REDMINE_DB_DATABASE")" \! -user redmine -exec chown redmine '{}' + 113 | fi 114 | fi 115 | 116 | REDMINE_DB_ADAPTER="$adapter" 117 | REDMINE_DB_HOST="$host" 118 | echo "$RAILS_ENV:" > config/database.yml 119 | for var in \ 120 | adapter \ 121 | host \ 122 | port \ 123 | username \ 124 | password \ 125 | database \ 126 | encoding \ 127 | ; do 128 | env="REDMINE_DB_${var^^}" 129 | val="${!env}" 130 | [ -n "$val" ] || continue 131 | if [ "$var" != 'adapter' ]; then 132 | # https://github.com/docker-library/redmine/issues/353 🙃 133 | val='"'"$val"'"' 134 | # (only add double quotes to every value *except* `adapter: xxx`) 135 | fi 136 | echo " $var: $val" >> config/database.yml 137 | done 138 | fi 139 | 140 | # install additional gems for Gemfile.local and plugins 141 | bundle check || bundle install 142 | 143 | file_env 'REDMINE_SECRET_KEY_BASE' 144 | # just use the rails variable rather than trying to put it into a yml file 145 | # https://github.com/rails/rails/blob/6-1-stable/railties/lib/rails/application.rb#L438 146 | # https://github.com/rails/rails/blob/1aa9987169213ce5ce43c20b2643bc64c235e792/railties/lib/rails/application.rb#L484 (rails 7.1-stable) 147 | if [ -n "${SECRET_KEY_BASE:-}" ] && [ -n "${REDMINE_SECRET_KEY_BASE:-}" ]; then 148 | echo >&2 149 | echo >&2 'warning: both SECRET_KEY_BASE and REDMINE_SECRET_KEY_BASE{_FILE} set, only SECRET_KEY_BASE will apply' 150 | echo >&2 151 | fi 152 | : "${SECRET_KEY_BASE:=${REDMINE_SECRET_KEY_BASE:-}}" 153 | export SECRET_KEY_BASE 154 | if [ -z "$SECRET_KEY_BASE" ]; then 155 | # https://github.com/docker-library/redmine/issues/397 156 | # empty string is truthy in ruby and so masks the generated fallback config 157 | # https://github.com/rails/rails/blob/1aa9987169213ce5ce43c20b2643bc64c235e792/railties/lib/rails/application.rb#L454 158 | unset SECRET_KEY_BASE 159 | # generate SECRET_KEY_BASE in-file since it is not set or empty; this is not recommended unless the secret_token.rb is saved when container is recreated 160 | if [ ! -f config/initializers/secret_token.rb ]; then 161 | echo >&2 162 | echo >&2 'warning: no *SECRET_KEY_BASE set; running `rake generate_secret_token` to create one in "config/initializers/secret_token.rb"' 163 | echo >&2 164 | rake generate_secret_token 165 | fi 166 | fi 167 | 168 | if [ "$1" != 'rake' -a -z "$REDMINE_NO_DB_MIGRATE" ]; then 169 | rake db:migrate 170 | fi 171 | 172 | if [ "$1" != 'rake' -a -n "$REDMINE_PLUGINS_MIGRATE" ]; then 173 | rake redmine:plugins:migrate 174 | fi 175 | 176 | # remove PID file to enable restarting the container 177 | rm -f tmp/pids/server.pid 178 | fi 179 | 180 | exec "$@" 181 | -------------------------------------------------------------------------------- /5.1/bookworm/docker-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -Eeo pipefail 3 | # TODO add "-u" 4 | 5 | # usage: file_env VAR [DEFAULT] 6 | # ie: file_env 'XYZ_DB_PASSWORD' 'example' 7 | # (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of 8 | # "$XYZ_DB_PASSWORD" from a file, especially for Docker's secrets feature) 9 | file_env() { 10 | local var="$1" 11 | local fileVar="${var}_FILE" 12 | local def="${2:-}" 13 | if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then 14 | echo >&2 "error: both $var and $fileVar are set (but are exclusive)" 15 | exit 1 16 | fi 17 | local val="$def" 18 | if [ "${!var:-}" ]; then 19 | val="${!var}" 20 | elif [ "${!fileVar:-}" ]; then 21 | val="$(< "${!fileVar}")" 22 | fi 23 | export "$var"="$val" 24 | unset "$fileVar" 25 | } 26 | 27 | isLikelyRedmine= 28 | case "$1" in 29 | rails | rake ) isLikelyRedmine=1 ;; 30 | bundle ) if [ "${2:-}" = 'exec' ]; then isLikelyRedmine=1; fi ;; # https://github.com/docker-library/redmine/pull/386 - "bundle exec sidekiq" 31 | esac 32 | 33 | _fix_permissions() { 34 | # https://www.redmine.org/projects/redmine/wiki/RedmineInstall#Step-8-File-system-permissions 35 | local dirs=( config log public/*assets tmp ) args=() 36 | if [ "$(id -u)" = '0' ]; then 37 | args+=( ${args[@]:+,} '(' '!' -user redmine -exec chown redmine:redmine '{}' + ')' ) 38 | 39 | # https://github.com/docker-library/redmine/issues/268 - scanning "files" might be *really* expensive, so we should skip it if it seems like it's "already correct" 40 | local filesOwnerMode 41 | filesOwnerMode="$(stat -c '%U:%a' files)" 42 | if [ "$filesOwnerMode" != 'redmine:755' ]; then 43 | dirs+=( files ) 44 | fi 45 | fi 46 | # directories 755, files 644: 47 | args+=( ${args[@]:+,} '(' -type d '!' -perm 755 -exec sh -c 'chmod 755 "$@" 2>/dev/null || :' -- '{}' + ')' ) 48 | args+=( ${args[@]:+,} '(' -type f '!' -perm 644 -exec sh -c 'chmod 644 "$@" 2>/dev/null || :' -- '{}' + ')' ) 49 | find "${dirs[@]}" "${args[@]}" 50 | } 51 | 52 | # allow the container to be started with `--user` 53 | if [ -n "$isLikelyRedmine" ] && [ "$(id -u)" = '0' ]; then 54 | _fix_permissions 55 | exec gosu redmine "$BASH_SOURCE" "$@" 56 | fi 57 | 58 | if [ -n "$isLikelyRedmine" ]; then 59 | _fix_permissions 60 | if [ ! -f './config/database.yml' ]; then 61 | file_env 'REDMINE_DB_MYSQL' 62 | file_env 'REDMINE_DB_POSTGRES' 63 | file_env 'REDMINE_DB_SQLSERVER' 64 | 65 | if [ "$MYSQL_PORT_3306_TCP" ] && [ -z "$REDMINE_DB_MYSQL" ]; then 66 | export REDMINE_DB_MYSQL='mysql' 67 | elif [ "$POSTGRES_PORT_5432_TCP" ] && [ -z "$REDMINE_DB_POSTGRES" ]; then 68 | export REDMINE_DB_POSTGRES='postgres' 69 | fi 70 | 71 | if [ "$REDMINE_DB_MYSQL" ]; then 72 | adapter='mysql2' 73 | host="$REDMINE_DB_MYSQL" 74 | file_env 'REDMINE_DB_PORT' '3306' 75 | file_env 'REDMINE_DB_USERNAME' "${MYSQL_ENV_MYSQL_USER:-root}" 76 | file_env 'REDMINE_DB_PASSWORD' "${MYSQL_ENV_MYSQL_PASSWORD:-${MYSQL_ENV_MYSQL_ROOT_PASSWORD:-}}" 77 | file_env 'REDMINE_DB_DATABASE' "${MYSQL_ENV_MYSQL_DATABASE:-${MYSQL_ENV_MYSQL_USER:-redmine}}" 78 | file_env 'REDMINE_DB_ENCODING' '' 79 | elif [ "$REDMINE_DB_POSTGRES" ]; then 80 | adapter='postgresql' 81 | host="$REDMINE_DB_POSTGRES" 82 | file_env 'REDMINE_DB_PORT' '5432' 83 | file_env 'REDMINE_DB_USERNAME' "${POSTGRES_ENV_POSTGRES_USER:-postgres}" 84 | file_env 'REDMINE_DB_PASSWORD' "${POSTGRES_ENV_POSTGRES_PASSWORD}" 85 | file_env 'REDMINE_DB_DATABASE' "${POSTGRES_ENV_POSTGRES_DB:-${REDMINE_DB_USERNAME:-}}" 86 | file_env 'REDMINE_DB_ENCODING' 'utf8' 87 | elif [ "$REDMINE_DB_SQLSERVER" ]; then 88 | adapter='sqlserver' 89 | host="$REDMINE_DB_SQLSERVER" 90 | file_env 'REDMINE_DB_PORT' '1433' 91 | file_env 'REDMINE_DB_USERNAME' '' 92 | file_env 'REDMINE_DB_PASSWORD' '' 93 | file_env 'REDMINE_DB_DATABASE' '' 94 | file_env 'REDMINE_DB_ENCODING' '' 95 | else 96 | echo >&2 97 | echo >&2 'warning: missing REDMINE_DB_MYSQL, REDMINE_DB_POSTGRES, or REDMINE_DB_SQLSERVER environment variables' 98 | echo >&2 99 | echo >&2 '*** Using sqlite3 as fallback. ***' 100 | echo >&2 101 | 102 | adapter='sqlite3' 103 | host='localhost' 104 | file_env 'REDMINE_DB_PORT' '' 105 | file_env 'REDMINE_DB_USERNAME' 'redmine' 106 | file_env 'REDMINE_DB_PASSWORD' '' 107 | file_env 'REDMINE_DB_DATABASE' 'sqlite/redmine.db' 108 | file_env 'REDMINE_DB_ENCODING' 'utf8' 109 | 110 | mkdir -p "$(dirname "$REDMINE_DB_DATABASE")" 111 | if [ "$(id -u)" = '0' ]; then 112 | find "$(dirname "$REDMINE_DB_DATABASE")" \! -user redmine -exec chown redmine '{}' + 113 | fi 114 | fi 115 | 116 | REDMINE_DB_ADAPTER="$adapter" 117 | REDMINE_DB_HOST="$host" 118 | echo "$RAILS_ENV:" > config/database.yml 119 | for var in \ 120 | adapter \ 121 | host \ 122 | port \ 123 | username \ 124 | password \ 125 | database \ 126 | encoding \ 127 | ; do 128 | env="REDMINE_DB_${var^^}" 129 | val="${!env}" 130 | [ -n "$val" ] || continue 131 | if [ "$var" != 'adapter' ]; then 132 | # https://github.com/docker-library/redmine/issues/353 🙃 133 | val='"'"$val"'"' 134 | # (only add double quotes to every value *except* `adapter: xxx`) 135 | fi 136 | echo " $var: $val" >> config/database.yml 137 | done 138 | fi 139 | 140 | # install additional gems for Gemfile.local and plugins 141 | bundle check || bundle install 142 | 143 | file_env 'REDMINE_SECRET_KEY_BASE' 144 | # just use the rails variable rather than trying to put it into a yml file 145 | # https://github.com/rails/rails/blob/6-1-stable/railties/lib/rails/application.rb#L438 146 | # https://github.com/rails/rails/blob/1aa9987169213ce5ce43c20b2643bc64c235e792/railties/lib/rails/application.rb#L484 (rails 7.1-stable) 147 | if [ -n "${SECRET_KEY_BASE:-}" ] && [ -n "${REDMINE_SECRET_KEY_BASE:-}" ]; then 148 | echo >&2 149 | echo >&2 'warning: both SECRET_KEY_BASE and REDMINE_SECRET_KEY_BASE{_FILE} set, only SECRET_KEY_BASE will apply' 150 | echo >&2 151 | fi 152 | : "${SECRET_KEY_BASE:=${REDMINE_SECRET_KEY_BASE:-}}" 153 | export SECRET_KEY_BASE 154 | if [ -z "$SECRET_KEY_BASE" ]; then 155 | # https://github.com/docker-library/redmine/issues/397 156 | # empty string is truthy in ruby and so masks the generated fallback config 157 | # https://github.com/rails/rails/blob/1aa9987169213ce5ce43c20b2643bc64c235e792/railties/lib/rails/application.rb#L454 158 | unset SECRET_KEY_BASE 159 | # generate SECRET_KEY_BASE in-file since it is not set or empty; this is not recommended unless the secret_token.rb is saved when container is recreated 160 | if [ ! -f config/initializers/secret_token.rb ]; then 161 | echo >&2 162 | echo >&2 'warning: no *SECRET_KEY_BASE set; running `rake generate_secret_token` to create one in "config/initializers/secret_token.rb"' 163 | echo >&2 164 | rake generate_secret_token 165 | fi 166 | fi 167 | 168 | if [ "$1" != 'rake' -a -z "$REDMINE_NO_DB_MIGRATE" ]; then 169 | rake db:migrate 170 | fi 171 | 172 | if [ "$1" != 'rake' -a -n "$REDMINE_PLUGINS_MIGRATE" ]; then 173 | rake redmine:plugins:migrate 174 | fi 175 | 176 | # remove PID file to enable restarting the container 177 | rm -f tmp/pids/server.pid 178 | fi 179 | 180 | exec "$@" 181 | -------------------------------------------------------------------------------- /6.0/alpine3.22/docker-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -Eeo pipefail 3 | # TODO add "-u" 4 | 5 | # usage: file_env VAR [DEFAULT] 6 | # ie: file_env 'XYZ_DB_PASSWORD' 'example' 7 | # (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of 8 | # "$XYZ_DB_PASSWORD" from a file, especially for Docker's secrets feature) 9 | file_env() { 10 | local var="$1" 11 | local fileVar="${var}_FILE" 12 | local def="${2:-}" 13 | if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then 14 | echo >&2 "error: both $var and $fileVar are set (but are exclusive)" 15 | exit 1 16 | fi 17 | local val="$def" 18 | if [ "${!var:-}" ]; then 19 | val="${!var}" 20 | elif [ "${!fileVar:-}" ]; then 21 | val="$(< "${!fileVar}")" 22 | fi 23 | export "$var"="$val" 24 | unset "$fileVar" 25 | } 26 | 27 | isLikelyRedmine= 28 | case "$1" in 29 | rails | rake ) isLikelyRedmine=1 ;; 30 | bundle ) if [ "${2:-}" = 'exec' ]; then isLikelyRedmine=1; fi ;; # https://github.com/docker-library/redmine/pull/386 - "bundle exec sidekiq" 31 | esac 32 | 33 | _fix_permissions() { 34 | # https://www.redmine.org/projects/redmine/wiki/RedmineInstall#Step-8-File-system-permissions 35 | local dirs=( config log public/*assets tmp ) args=() 36 | if [ "$(id -u)" = '0' ]; then 37 | args+=( ${args[@]:+,} '(' '!' -user redmine -exec chown redmine:redmine '{}' + ')' ) 38 | 39 | # https://github.com/docker-library/redmine/issues/268 - scanning "files" might be *really* expensive, so we should skip it if it seems like it's "already correct" 40 | local filesOwnerMode 41 | filesOwnerMode="$(stat -c '%U:%a' files)" 42 | if [ "$filesOwnerMode" != 'redmine:755' ]; then 43 | dirs+=( files ) 44 | fi 45 | fi 46 | # directories 755, files 644: 47 | args+=( ${args[@]:+,} '(' -type d '!' -perm 755 -exec sh -c 'chmod 755 "$@" 2>/dev/null || :' -- '{}' + ')' ) 48 | args+=( ${args[@]:+,} '(' -type f '!' -perm 644 -exec sh -c 'chmod 644 "$@" 2>/dev/null || :' -- '{}' + ')' ) 49 | find "${dirs[@]}" "${args[@]}" 50 | } 51 | 52 | # allow the container to be started with `--user` 53 | if [ -n "$isLikelyRedmine" ] && [ "$(id -u)" = '0' ]; then 54 | _fix_permissions 55 | exec gosu redmine "$BASH_SOURCE" "$@" 56 | fi 57 | 58 | if [ -n "$isLikelyRedmine" ]; then 59 | _fix_permissions 60 | if [ ! -f './config/database.yml' ]; then 61 | file_env 'REDMINE_DB_MYSQL' 62 | file_env 'REDMINE_DB_POSTGRES' 63 | file_env 'REDMINE_DB_SQLSERVER' 64 | 65 | if [ "$MYSQL_PORT_3306_TCP" ] && [ -z "$REDMINE_DB_MYSQL" ]; then 66 | export REDMINE_DB_MYSQL='mysql' 67 | elif [ "$POSTGRES_PORT_5432_TCP" ] && [ -z "$REDMINE_DB_POSTGRES" ]; then 68 | export REDMINE_DB_POSTGRES='postgres' 69 | fi 70 | 71 | if [ "$REDMINE_DB_MYSQL" ]; then 72 | adapter='mysql2' 73 | host="$REDMINE_DB_MYSQL" 74 | file_env 'REDMINE_DB_PORT' '3306' 75 | file_env 'REDMINE_DB_USERNAME' "${MYSQL_ENV_MYSQL_USER:-root}" 76 | file_env 'REDMINE_DB_PASSWORD' "${MYSQL_ENV_MYSQL_PASSWORD:-${MYSQL_ENV_MYSQL_ROOT_PASSWORD:-}}" 77 | file_env 'REDMINE_DB_DATABASE' "${MYSQL_ENV_MYSQL_DATABASE:-${MYSQL_ENV_MYSQL_USER:-redmine}}" 78 | file_env 'REDMINE_DB_ENCODING' '' 79 | elif [ "$REDMINE_DB_POSTGRES" ]; then 80 | adapter='postgresql' 81 | host="$REDMINE_DB_POSTGRES" 82 | file_env 'REDMINE_DB_PORT' '5432' 83 | file_env 'REDMINE_DB_USERNAME' "${POSTGRES_ENV_POSTGRES_USER:-postgres}" 84 | file_env 'REDMINE_DB_PASSWORD' "${POSTGRES_ENV_POSTGRES_PASSWORD}" 85 | file_env 'REDMINE_DB_DATABASE' "${POSTGRES_ENV_POSTGRES_DB:-${REDMINE_DB_USERNAME:-}}" 86 | file_env 'REDMINE_DB_ENCODING' 'utf8' 87 | elif [ "$REDMINE_DB_SQLSERVER" ]; then 88 | adapter='sqlserver' 89 | host="$REDMINE_DB_SQLSERVER" 90 | file_env 'REDMINE_DB_PORT' '1433' 91 | file_env 'REDMINE_DB_USERNAME' '' 92 | file_env 'REDMINE_DB_PASSWORD' '' 93 | file_env 'REDMINE_DB_DATABASE' '' 94 | file_env 'REDMINE_DB_ENCODING' '' 95 | else 96 | echo >&2 97 | echo >&2 'warning: missing REDMINE_DB_MYSQL, REDMINE_DB_POSTGRES, or REDMINE_DB_SQLSERVER environment variables' 98 | echo >&2 99 | echo >&2 '*** Using sqlite3 as fallback. ***' 100 | echo >&2 101 | 102 | adapter='sqlite3' 103 | host='localhost' 104 | file_env 'REDMINE_DB_PORT' '' 105 | file_env 'REDMINE_DB_USERNAME' 'redmine' 106 | file_env 'REDMINE_DB_PASSWORD' '' 107 | file_env 'REDMINE_DB_DATABASE' 'sqlite/redmine.db' 108 | file_env 'REDMINE_DB_ENCODING' 'utf8' 109 | 110 | mkdir -p "$(dirname "$REDMINE_DB_DATABASE")" 111 | if [ "$(id -u)" = '0' ]; then 112 | find "$(dirname "$REDMINE_DB_DATABASE")" \! -user redmine -exec chown redmine '{}' + 113 | fi 114 | fi 115 | 116 | REDMINE_DB_ADAPTER="$adapter" 117 | REDMINE_DB_HOST="$host" 118 | echo "$RAILS_ENV:" > config/database.yml 119 | for var in \ 120 | adapter \ 121 | host \ 122 | port \ 123 | username \ 124 | password \ 125 | database \ 126 | encoding \ 127 | ; do 128 | env="REDMINE_DB_${var^^}" 129 | val="${!env}" 130 | [ -n "$val" ] || continue 131 | if [ "$var" != 'adapter' ]; then 132 | # https://github.com/docker-library/redmine/issues/353 🙃 133 | val='"'"$val"'"' 134 | # (only add double quotes to every value *except* `adapter: xxx`) 135 | fi 136 | echo " $var: $val" >> config/database.yml 137 | done 138 | fi 139 | 140 | # install additional gems for Gemfile.local and plugins 141 | bundle check || bundle install 142 | 143 | file_env 'REDMINE_SECRET_KEY_BASE' 144 | # just use the rails variable rather than trying to put it into a yml file 145 | # https://github.com/rails/rails/blob/6-1-stable/railties/lib/rails/application.rb#L438 146 | # https://github.com/rails/rails/blob/1aa9987169213ce5ce43c20b2643bc64c235e792/railties/lib/rails/application.rb#L484 (rails 7.1-stable) 147 | if [ -n "${SECRET_KEY_BASE:-}" ] && [ -n "${REDMINE_SECRET_KEY_BASE:-}" ]; then 148 | echo >&2 149 | echo >&2 'warning: both SECRET_KEY_BASE and REDMINE_SECRET_KEY_BASE{_FILE} set, only SECRET_KEY_BASE will apply' 150 | echo >&2 151 | fi 152 | : "${SECRET_KEY_BASE:=${REDMINE_SECRET_KEY_BASE:-}}" 153 | export SECRET_KEY_BASE 154 | if [ -z "$SECRET_KEY_BASE" ]; then 155 | # https://github.com/docker-library/redmine/issues/397 156 | # empty string is truthy in ruby and so masks the generated fallback config 157 | # https://github.com/rails/rails/blob/1aa9987169213ce5ce43c20b2643bc64c235e792/railties/lib/rails/application.rb#L454 158 | unset SECRET_KEY_BASE 159 | # generate SECRET_KEY_BASE in-file since it is not set or empty; this is not recommended unless the secret_token.rb is saved when container is recreated 160 | if [ ! -f config/initializers/secret_token.rb ]; then 161 | echo >&2 162 | echo >&2 'warning: no *SECRET_KEY_BASE set; running `rake generate_secret_token` to create one in "config/initializers/secret_token.rb"' 163 | echo >&2 164 | rake generate_secret_token 165 | fi 166 | fi 167 | 168 | if [ "$1" != 'rake' -a -z "$REDMINE_NO_DB_MIGRATE" ]; then 169 | rake db:migrate 170 | fi 171 | 172 | if [ "$1" != 'rake' -a -n "$REDMINE_PLUGINS_MIGRATE" ]; then 173 | rake redmine:plugins:migrate 174 | fi 175 | 176 | # remove PID file to enable restarting the container 177 | rm -f tmp/pids/server.pid 178 | fi 179 | 180 | exec "$@" 181 | -------------------------------------------------------------------------------- /6.0/alpine3.23/docker-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -Eeo pipefail 3 | # TODO add "-u" 4 | 5 | # usage: file_env VAR [DEFAULT] 6 | # ie: file_env 'XYZ_DB_PASSWORD' 'example' 7 | # (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of 8 | # "$XYZ_DB_PASSWORD" from a file, especially for Docker's secrets feature) 9 | file_env() { 10 | local var="$1" 11 | local fileVar="${var}_FILE" 12 | local def="${2:-}" 13 | if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then 14 | echo >&2 "error: both $var and $fileVar are set (but are exclusive)" 15 | exit 1 16 | fi 17 | local val="$def" 18 | if [ "${!var:-}" ]; then 19 | val="${!var}" 20 | elif [ "${!fileVar:-}" ]; then 21 | val="$(< "${!fileVar}")" 22 | fi 23 | export "$var"="$val" 24 | unset "$fileVar" 25 | } 26 | 27 | isLikelyRedmine= 28 | case "$1" in 29 | rails | rake ) isLikelyRedmine=1 ;; 30 | bundle ) if [ "${2:-}" = 'exec' ]; then isLikelyRedmine=1; fi ;; # https://github.com/docker-library/redmine/pull/386 - "bundle exec sidekiq" 31 | esac 32 | 33 | _fix_permissions() { 34 | # https://www.redmine.org/projects/redmine/wiki/RedmineInstall#Step-8-File-system-permissions 35 | local dirs=( config log public/*assets tmp ) args=() 36 | if [ "$(id -u)" = '0' ]; then 37 | args+=( ${args[@]:+,} '(' '!' -user redmine -exec chown redmine:redmine '{}' + ')' ) 38 | 39 | # https://github.com/docker-library/redmine/issues/268 - scanning "files" might be *really* expensive, so we should skip it if it seems like it's "already correct" 40 | local filesOwnerMode 41 | filesOwnerMode="$(stat -c '%U:%a' files)" 42 | if [ "$filesOwnerMode" != 'redmine:755' ]; then 43 | dirs+=( files ) 44 | fi 45 | fi 46 | # directories 755, files 644: 47 | args+=( ${args[@]:+,} '(' -type d '!' -perm 755 -exec sh -c 'chmod 755 "$@" 2>/dev/null || :' -- '{}' + ')' ) 48 | args+=( ${args[@]:+,} '(' -type f '!' -perm 644 -exec sh -c 'chmod 644 "$@" 2>/dev/null || :' -- '{}' + ')' ) 49 | find "${dirs[@]}" "${args[@]}" 50 | } 51 | 52 | # allow the container to be started with `--user` 53 | if [ -n "$isLikelyRedmine" ] && [ "$(id -u)" = '0' ]; then 54 | _fix_permissions 55 | exec gosu redmine "$BASH_SOURCE" "$@" 56 | fi 57 | 58 | if [ -n "$isLikelyRedmine" ]; then 59 | _fix_permissions 60 | if [ ! -f './config/database.yml' ]; then 61 | file_env 'REDMINE_DB_MYSQL' 62 | file_env 'REDMINE_DB_POSTGRES' 63 | file_env 'REDMINE_DB_SQLSERVER' 64 | 65 | if [ "$MYSQL_PORT_3306_TCP" ] && [ -z "$REDMINE_DB_MYSQL" ]; then 66 | export REDMINE_DB_MYSQL='mysql' 67 | elif [ "$POSTGRES_PORT_5432_TCP" ] && [ -z "$REDMINE_DB_POSTGRES" ]; then 68 | export REDMINE_DB_POSTGRES='postgres' 69 | fi 70 | 71 | if [ "$REDMINE_DB_MYSQL" ]; then 72 | adapter='mysql2' 73 | host="$REDMINE_DB_MYSQL" 74 | file_env 'REDMINE_DB_PORT' '3306' 75 | file_env 'REDMINE_DB_USERNAME' "${MYSQL_ENV_MYSQL_USER:-root}" 76 | file_env 'REDMINE_DB_PASSWORD' "${MYSQL_ENV_MYSQL_PASSWORD:-${MYSQL_ENV_MYSQL_ROOT_PASSWORD:-}}" 77 | file_env 'REDMINE_DB_DATABASE' "${MYSQL_ENV_MYSQL_DATABASE:-${MYSQL_ENV_MYSQL_USER:-redmine}}" 78 | file_env 'REDMINE_DB_ENCODING' '' 79 | elif [ "$REDMINE_DB_POSTGRES" ]; then 80 | adapter='postgresql' 81 | host="$REDMINE_DB_POSTGRES" 82 | file_env 'REDMINE_DB_PORT' '5432' 83 | file_env 'REDMINE_DB_USERNAME' "${POSTGRES_ENV_POSTGRES_USER:-postgres}" 84 | file_env 'REDMINE_DB_PASSWORD' "${POSTGRES_ENV_POSTGRES_PASSWORD}" 85 | file_env 'REDMINE_DB_DATABASE' "${POSTGRES_ENV_POSTGRES_DB:-${REDMINE_DB_USERNAME:-}}" 86 | file_env 'REDMINE_DB_ENCODING' 'utf8' 87 | elif [ "$REDMINE_DB_SQLSERVER" ]; then 88 | adapter='sqlserver' 89 | host="$REDMINE_DB_SQLSERVER" 90 | file_env 'REDMINE_DB_PORT' '1433' 91 | file_env 'REDMINE_DB_USERNAME' '' 92 | file_env 'REDMINE_DB_PASSWORD' '' 93 | file_env 'REDMINE_DB_DATABASE' '' 94 | file_env 'REDMINE_DB_ENCODING' '' 95 | else 96 | echo >&2 97 | echo >&2 'warning: missing REDMINE_DB_MYSQL, REDMINE_DB_POSTGRES, or REDMINE_DB_SQLSERVER environment variables' 98 | echo >&2 99 | echo >&2 '*** Using sqlite3 as fallback. ***' 100 | echo >&2 101 | 102 | adapter='sqlite3' 103 | host='localhost' 104 | file_env 'REDMINE_DB_PORT' '' 105 | file_env 'REDMINE_DB_USERNAME' 'redmine' 106 | file_env 'REDMINE_DB_PASSWORD' '' 107 | file_env 'REDMINE_DB_DATABASE' 'sqlite/redmine.db' 108 | file_env 'REDMINE_DB_ENCODING' 'utf8' 109 | 110 | mkdir -p "$(dirname "$REDMINE_DB_DATABASE")" 111 | if [ "$(id -u)" = '0' ]; then 112 | find "$(dirname "$REDMINE_DB_DATABASE")" \! -user redmine -exec chown redmine '{}' + 113 | fi 114 | fi 115 | 116 | REDMINE_DB_ADAPTER="$adapter" 117 | REDMINE_DB_HOST="$host" 118 | echo "$RAILS_ENV:" > config/database.yml 119 | for var in \ 120 | adapter \ 121 | host \ 122 | port \ 123 | username \ 124 | password \ 125 | database \ 126 | encoding \ 127 | ; do 128 | env="REDMINE_DB_${var^^}" 129 | val="${!env}" 130 | [ -n "$val" ] || continue 131 | if [ "$var" != 'adapter' ]; then 132 | # https://github.com/docker-library/redmine/issues/353 🙃 133 | val='"'"$val"'"' 134 | # (only add double quotes to every value *except* `adapter: xxx`) 135 | fi 136 | echo " $var: $val" >> config/database.yml 137 | done 138 | fi 139 | 140 | # install additional gems for Gemfile.local and plugins 141 | bundle check || bundle install 142 | 143 | file_env 'REDMINE_SECRET_KEY_BASE' 144 | # just use the rails variable rather than trying to put it into a yml file 145 | # https://github.com/rails/rails/blob/6-1-stable/railties/lib/rails/application.rb#L438 146 | # https://github.com/rails/rails/blob/1aa9987169213ce5ce43c20b2643bc64c235e792/railties/lib/rails/application.rb#L484 (rails 7.1-stable) 147 | if [ -n "${SECRET_KEY_BASE:-}" ] && [ -n "${REDMINE_SECRET_KEY_BASE:-}" ]; then 148 | echo >&2 149 | echo >&2 'warning: both SECRET_KEY_BASE and REDMINE_SECRET_KEY_BASE{_FILE} set, only SECRET_KEY_BASE will apply' 150 | echo >&2 151 | fi 152 | : "${SECRET_KEY_BASE:=${REDMINE_SECRET_KEY_BASE:-}}" 153 | export SECRET_KEY_BASE 154 | if [ -z "$SECRET_KEY_BASE" ]; then 155 | # https://github.com/docker-library/redmine/issues/397 156 | # empty string is truthy in ruby and so masks the generated fallback config 157 | # https://github.com/rails/rails/blob/1aa9987169213ce5ce43c20b2643bc64c235e792/railties/lib/rails/application.rb#L454 158 | unset SECRET_KEY_BASE 159 | # generate SECRET_KEY_BASE in-file since it is not set or empty; this is not recommended unless the secret_token.rb is saved when container is recreated 160 | if [ ! -f config/initializers/secret_token.rb ]; then 161 | echo >&2 162 | echo >&2 'warning: no *SECRET_KEY_BASE set; running `rake generate_secret_token` to create one in "config/initializers/secret_token.rb"' 163 | echo >&2 164 | rake generate_secret_token 165 | fi 166 | fi 167 | 168 | if [ "$1" != 'rake' -a -z "$REDMINE_NO_DB_MIGRATE" ]; then 169 | rake db:migrate 170 | fi 171 | 172 | if [ "$1" != 'rake' -a -n "$REDMINE_PLUGINS_MIGRATE" ]; then 173 | rake redmine:plugins:migrate 174 | fi 175 | 176 | # remove PID file to enable restarting the container 177 | rm -f tmp/pids/server.pid 178 | fi 179 | 180 | exec "$@" 181 | -------------------------------------------------------------------------------- /6.0/bookworm/docker-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -Eeo pipefail 3 | # TODO add "-u" 4 | 5 | # usage: file_env VAR [DEFAULT] 6 | # ie: file_env 'XYZ_DB_PASSWORD' 'example' 7 | # (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of 8 | # "$XYZ_DB_PASSWORD" from a file, especially for Docker's secrets feature) 9 | file_env() { 10 | local var="$1" 11 | local fileVar="${var}_FILE" 12 | local def="${2:-}" 13 | if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then 14 | echo >&2 "error: both $var and $fileVar are set (but are exclusive)" 15 | exit 1 16 | fi 17 | local val="$def" 18 | if [ "${!var:-}" ]; then 19 | val="${!var}" 20 | elif [ "${!fileVar:-}" ]; then 21 | val="$(< "${!fileVar}")" 22 | fi 23 | export "$var"="$val" 24 | unset "$fileVar" 25 | } 26 | 27 | isLikelyRedmine= 28 | case "$1" in 29 | rails | rake ) isLikelyRedmine=1 ;; 30 | bundle ) if [ "${2:-}" = 'exec' ]; then isLikelyRedmine=1; fi ;; # https://github.com/docker-library/redmine/pull/386 - "bundle exec sidekiq" 31 | esac 32 | 33 | _fix_permissions() { 34 | # https://www.redmine.org/projects/redmine/wiki/RedmineInstall#Step-8-File-system-permissions 35 | local dirs=( config log public/*assets tmp ) args=() 36 | if [ "$(id -u)" = '0' ]; then 37 | args+=( ${args[@]:+,} '(' '!' -user redmine -exec chown redmine:redmine '{}' + ')' ) 38 | 39 | # https://github.com/docker-library/redmine/issues/268 - scanning "files" might be *really* expensive, so we should skip it if it seems like it's "already correct" 40 | local filesOwnerMode 41 | filesOwnerMode="$(stat -c '%U:%a' files)" 42 | if [ "$filesOwnerMode" != 'redmine:755' ]; then 43 | dirs+=( files ) 44 | fi 45 | fi 46 | # directories 755, files 644: 47 | args+=( ${args[@]:+,} '(' -type d '!' -perm 755 -exec sh -c 'chmod 755 "$@" 2>/dev/null || :' -- '{}' + ')' ) 48 | args+=( ${args[@]:+,} '(' -type f '!' -perm 644 -exec sh -c 'chmod 644 "$@" 2>/dev/null || :' -- '{}' + ')' ) 49 | find "${dirs[@]}" "${args[@]}" 50 | } 51 | 52 | # allow the container to be started with `--user` 53 | if [ -n "$isLikelyRedmine" ] && [ "$(id -u)" = '0' ]; then 54 | _fix_permissions 55 | exec gosu redmine "$BASH_SOURCE" "$@" 56 | fi 57 | 58 | if [ -n "$isLikelyRedmine" ]; then 59 | _fix_permissions 60 | if [ ! -f './config/database.yml' ]; then 61 | file_env 'REDMINE_DB_MYSQL' 62 | file_env 'REDMINE_DB_POSTGRES' 63 | file_env 'REDMINE_DB_SQLSERVER' 64 | 65 | if [ "$MYSQL_PORT_3306_TCP" ] && [ -z "$REDMINE_DB_MYSQL" ]; then 66 | export REDMINE_DB_MYSQL='mysql' 67 | elif [ "$POSTGRES_PORT_5432_TCP" ] && [ -z "$REDMINE_DB_POSTGRES" ]; then 68 | export REDMINE_DB_POSTGRES='postgres' 69 | fi 70 | 71 | if [ "$REDMINE_DB_MYSQL" ]; then 72 | adapter='mysql2' 73 | host="$REDMINE_DB_MYSQL" 74 | file_env 'REDMINE_DB_PORT' '3306' 75 | file_env 'REDMINE_DB_USERNAME' "${MYSQL_ENV_MYSQL_USER:-root}" 76 | file_env 'REDMINE_DB_PASSWORD' "${MYSQL_ENV_MYSQL_PASSWORD:-${MYSQL_ENV_MYSQL_ROOT_PASSWORD:-}}" 77 | file_env 'REDMINE_DB_DATABASE' "${MYSQL_ENV_MYSQL_DATABASE:-${MYSQL_ENV_MYSQL_USER:-redmine}}" 78 | file_env 'REDMINE_DB_ENCODING' '' 79 | elif [ "$REDMINE_DB_POSTGRES" ]; then 80 | adapter='postgresql' 81 | host="$REDMINE_DB_POSTGRES" 82 | file_env 'REDMINE_DB_PORT' '5432' 83 | file_env 'REDMINE_DB_USERNAME' "${POSTGRES_ENV_POSTGRES_USER:-postgres}" 84 | file_env 'REDMINE_DB_PASSWORD' "${POSTGRES_ENV_POSTGRES_PASSWORD}" 85 | file_env 'REDMINE_DB_DATABASE' "${POSTGRES_ENV_POSTGRES_DB:-${REDMINE_DB_USERNAME:-}}" 86 | file_env 'REDMINE_DB_ENCODING' 'utf8' 87 | elif [ "$REDMINE_DB_SQLSERVER" ]; then 88 | adapter='sqlserver' 89 | host="$REDMINE_DB_SQLSERVER" 90 | file_env 'REDMINE_DB_PORT' '1433' 91 | file_env 'REDMINE_DB_USERNAME' '' 92 | file_env 'REDMINE_DB_PASSWORD' '' 93 | file_env 'REDMINE_DB_DATABASE' '' 94 | file_env 'REDMINE_DB_ENCODING' '' 95 | else 96 | echo >&2 97 | echo >&2 'warning: missing REDMINE_DB_MYSQL, REDMINE_DB_POSTGRES, or REDMINE_DB_SQLSERVER environment variables' 98 | echo >&2 99 | echo >&2 '*** Using sqlite3 as fallback. ***' 100 | echo >&2 101 | 102 | adapter='sqlite3' 103 | host='localhost' 104 | file_env 'REDMINE_DB_PORT' '' 105 | file_env 'REDMINE_DB_USERNAME' 'redmine' 106 | file_env 'REDMINE_DB_PASSWORD' '' 107 | file_env 'REDMINE_DB_DATABASE' 'sqlite/redmine.db' 108 | file_env 'REDMINE_DB_ENCODING' 'utf8' 109 | 110 | mkdir -p "$(dirname "$REDMINE_DB_DATABASE")" 111 | if [ "$(id -u)" = '0' ]; then 112 | find "$(dirname "$REDMINE_DB_DATABASE")" \! -user redmine -exec chown redmine '{}' + 113 | fi 114 | fi 115 | 116 | REDMINE_DB_ADAPTER="$adapter" 117 | REDMINE_DB_HOST="$host" 118 | echo "$RAILS_ENV:" > config/database.yml 119 | for var in \ 120 | adapter \ 121 | host \ 122 | port \ 123 | username \ 124 | password \ 125 | database \ 126 | encoding \ 127 | ; do 128 | env="REDMINE_DB_${var^^}" 129 | val="${!env}" 130 | [ -n "$val" ] || continue 131 | if [ "$var" != 'adapter' ]; then 132 | # https://github.com/docker-library/redmine/issues/353 🙃 133 | val='"'"$val"'"' 134 | # (only add double quotes to every value *except* `adapter: xxx`) 135 | fi 136 | echo " $var: $val" >> config/database.yml 137 | done 138 | fi 139 | 140 | # install additional gems for Gemfile.local and plugins 141 | bundle check || bundle install 142 | 143 | file_env 'REDMINE_SECRET_KEY_BASE' 144 | # just use the rails variable rather than trying to put it into a yml file 145 | # https://github.com/rails/rails/blob/6-1-stable/railties/lib/rails/application.rb#L438 146 | # https://github.com/rails/rails/blob/1aa9987169213ce5ce43c20b2643bc64c235e792/railties/lib/rails/application.rb#L484 (rails 7.1-stable) 147 | if [ -n "${SECRET_KEY_BASE:-}" ] && [ -n "${REDMINE_SECRET_KEY_BASE:-}" ]; then 148 | echo >&2 149 | echo >&2 'warning: both SECRET_KEY_BASE and REDMINE_SECRET_KEY_BASE{_FILE} set, only SECRET_KEY_BASE will apply' 150 | echo >&2 151 | fi 152 | : "${SECRET_KEY_BASE:=${REDMINE_SECRET_KEY_BASE:-}}" 153 | export SECRET_KEY_BASE 154 | if [ -z "$SECRET_KEY_BASE" ]; then 155 | # https://github.com/docker-library/redmine/issues/397 156 | # empty string is truthy in ruby and so masks the generated fallback config 157 | # https://github.com/rails/rails/blob/1aa9987169213ce5ce43c20b2643bc64c235e792/railties/lib/rails/application.rb#L454 158 | unset SECRET_KEY_BASE 159 | # generate SECRET_KEY_BASE in-file since it is not set or empty; this is not recommended unless the secret_token.rb is saved when container is recreated 160 | if [ ! -f config/initializers/secret_token.rb ]; then 161 | echo >&2 162 | echo >&2 'warning: no *SECRET_KEY_BASE set; running `rake generate_secret_token` to create one in "config/initializers/secret_token.rb"' 163 | echo >&2 164 | rake generate_secret_token 165 | fi 166 | fi 167 | 168 | if [ "$1" != 'rake' -a -z "$REDMINE_NO_DB_MIGRATE" ]; then 169 | rake db:migrate 170 | fi 171 | 172 | if [ "$1" != 'rake' -a -n "$REDMINE_PLUGINS_MIGRATE" ]; then 173 | rake redmine:plugins:migrate 174 | fi 175 | 176 | # remove PID file to enable restarting the container 177 | rm -f tmp/pids/server.pid 178 | fi 179 | 180 | exec "$@" 181 | -------------------------------------------------------------------------------- /6.1/alpine3.22/docker-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -Eeo pipefail 3 | # TODO add "-u" 4 | 5 | # usage: file_env VAR [DEFAULT] 6 | # ie: file_env 'XYZ_DB_PASSWORD' 'example' 7 | # (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of 8 | # "$XYZ_DB_PASSWORD" from a file, especially for Docker's secrets feature) 9 | file_env() { 10 | local var="$1" 11 | local fileVar="${var}_FILE" 12 | local def="${2:-}" 13 | if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then 14 | echo >&2 "error: both $var and $fileVar are set (but are exclusive)" 15 | exit 1 16 | fi 17 | local val="$def" 18 | if [ "${!var:-}" ]; then 19 | val="${!var}" 20 | elif [ "${!fileVar:-}" ]; then 21 | val="$(< "${!fileVar}")" 22 | fi 23 | export "$var"="$val" 24 | unset "$fileVar" 25 | } 26 | 27 | isLikelyRedmine= 28 | case "$1" in 29 | rails | rake ) isLikelyRedmine=1 ;; 30 | bundle ) if [ "${2:-}" = 'exec' ]; then isLikelyRedmine=1; fi ;; # https://github.com/docker-library/redmine/pull/386 - "bundle exec sidekiq" 31 | esac 32 | 33 | _fix_permissions() { 34 | # https://www.redmine.org/projects/redmine/wiki/RedmineInstall#Step-8-File-system-permissions 35 | local dirs=( config log public/*assets tmp ) args=() 36 | if [ "$(id -u)" = '0' ]; then 37 | args+=( ${args[@]:+,} '(' '!' -user redmine -exec chown redmine:redmine '{}' + ')' ) 38 | 39 | # https://github.com/docker-library/redmine/issues/268 - scanning "files" might be *really* expensive, so we should skip it if it seems like it's "already correct" 40 | local filesOwnerMode 41 | filesOwnerMode="$(stat -c '%U:%a' files)" 42 | if [ "$filesOwnerMode" != 'redmine:755' ]; then 43 | dirs+=( files ) 44 | fi 45 | fi 46 | # directories 755, files 644: 47 | args+=( ${args[@]:+,} '(' -type d '!' -perm 755 -exec sh -c 'chmod 755 "$@" 2>/dev/null || :' -- '{}' + ')' ) 48 | args+=( ${args[@]:+,} '(' -type f '!' -perm 644 -exec sh -c 'chmod 644 "$@" 2>/dev/null || :' -- '{}' + ')' ) 49 | find "${dirs[@]}" "${args[@]}" 50 | } 51 | 52 | # allow the container to be started with `--user` 53 | if [ -n "$isLikelyRedmine" ] && [ "$(id -u)" = '0' ]; then 54 | _fix_permissions 55 | exec gosu redmine "$BASH_SOURCE" "$@" 56 | fi 57 | 58 | if [ -n "$isLikelyRedmine" ]; then 59 | _fix_permissions 60 | if [ ! -f './config/database.yml' ]; then 61 | file_env 'REDMINE_DB_MYSQL' 62 | file_env 'REDMINE_DB_POSTGRES' 63 | file_env 'REDMINE_DB_SQLSERVER' 64 | 65 | if [ "$MYSQL_PORT_3306_TCP" ] && [ -z "$REDMINE_DB_MYSQL" ]; then 66 | export REDMINE_DB_MYSQL='mysql' 67 | elif [ "$POSTGRES_PORT_5432_TCP" ] && [ -z "$REDMINE_DB_POSTGRES" ]; then 68 | export REDMINE_DB_POSTGRES='postgres' 69 | fi 70 | 71 | if [ "$REDMINE_DB_MYSQL" ]; then 72 | adapter='mysql2' 73 | host="$REDMINE_DB_MYSQL" 74 | file_env 'REDMINE_DB_PORT' '3306' 75 | file_env 'REDMINE_DB_USERNAME' "${MYSQL_ENV_MYSQL_USER:-root}" 76 | file_env 'REDMINE_DB_PASSWORD' "${MYSQL_ENV_MYSQL_PASSWORD:-${MYSQL_ENV_MYSQL_ROOT_PASSWORD:-}}" 77 | file_env 'REDMINE_DB_DATABASE' "${MYSQL_ENV_MYSQL_DATABASE:-${MYSQL_ENV_MYSQL_USER:-redmine}}" 78 | file_env 'REDMINE_DB_ENCODING' '' 79 | elif [ "$REDMINE_DB_POSTGRES" ]; then 80 | adapter='postgresql' 81 | host="$REDMINE_DB_POSTGRES" 82 | file_env 'REDMINE_DB_PORT' '5432' 83 | file_env 'REDMINE_DB_USERNAME' "${POSTGRES_ENV_POSTGRES_USER:-postgres}" 84 | file_env 'REDMINE_DB_PASSWORD' "${POSTGRES_ENV_POSTGRES_PASSWORD}" 85 | file_env 'REDMINE_DB_DATABASE' "${POSTGRES_ENV_POSTGRES_DB:-${REDMINE_DB_USERNAME:-}}" 86 | file_env 'REDMINE_DB_ENCODING' 'utf8' 87 | elif [ "$REDMINE_DB_SQLSERVER" ]; then 88 | adapter='sqlserver' 89 | host="$REDMINE_DB_SQLSERVER" 90 | file_env 'REDMINE_DB_PORT' '1433' 91 | file_env 'REDMINE_DB_USERNAME' '' 92 | file_env 'REDMINE_DB_PASSWORD' '' 93 | file_env 'REDMINE_DB_DATABASE' '' 94 | file_env 'REDMINE_DB_ENCODING' '' 95 | else 96 | echo >&2 97 | echo >&2 'warning: missing REDMINE_DB_MYSQL, REDMINE_DB_POSTGRES, or REDMINE_DB_SQLSERVER environment variables' 98 | echo >&2 99 | echo >&2 '*** Using sqlite3 as fallback. ***' 100 | echo >&2 101 | 102 | adapter='sqlite3' 103 | host='localhost' 104 | file_env 'REDMINE_DB_PORT' '' 105 | file_env 'REDMINE_DB_USERNAME' 'redmine' 106 | file_env 'REDMINE_DB_PASSWORD' '' 107 | file_env 'REDMINE_DB_DATABASE' 'sqlite/redmine.db' 108 | file_env 'REDMINE_DB_ENCODING' 'utf8' 109 | 110 | mkdir -p "$(dirname "$REDMINE_DB_DATABASE")" 111 | if [ "$(id -u)" = '0' ]; then 112 | find "$(dirname "$REDMINE_DB_DATABASE")" \! -user redmine -exec chown redmine '{}' + 113 | fi 114 | fi 115 | 116 | REDMINE_DB_ADAPTER="$adapter" 117 | REDMINE_DB_HOST="$host" 118 | echo "$RAILS_ENV:" > config/database.yml 119 | for var in \ 120 | adapter \ 121 | host \ 122 | port \ 123 | username \ 124 | password \ 125 | database \ 126 | encoding \ 127 | ; do 128 | env="REDMINE_DB_${var^^}" 129 | val="${!env}" 130 | [ -n "$val" ] || continue 131 | if [ "$var" != 'adapter' ]; then 132 | # https://github.com/docker-library/redmine/issues/353 🙃 133 | val='"'"$val"'"' 134 | # (only add double quotes to every value *except* `adapter: xxx`) 135 | fi 136 | echo " $var: $val" >> config/database.yml 137 | done 138 | fi 139 | 140 | # install additional gems for Gemfile.local and plugins 141 | bundle check || bundle install 142 | 143 | file_env 'REDMINE_SECRET_KEY_BASE' 144 | # just use the rails variable rather than trying to put it into a yml file 145 | # https://github.com/rails/rails/blob/6-1-stable/railties/lib/rails/application.rb#L438 146 | # https://github.com/rails/rails/blob/1aa9987169213ce5ce43c20b2643bc64c235e792/railties/lib/rails/application.rb#L484 (rails 7.1-stable) 147 | if [ -n "${SECRET_KEY_BASE:-}" ] && [ -n "${REDMINE_SECRET_KEY_BASE:-}" ]; then 148 | echo >&2 149 | echo >&2 'warning: both SECRET_KEY_BASE and REDMINE_SECRET_KEY_BASE{_FILE} set, only SECRET_KEY_BASE will apply' 150 | echo >&2 151 | fi 152 | : "${SECRET_KEY_BASE:=${REDMINE_SECRET_KEY_BASE:-}}" 153 | export SECRET_KEY_BASE 154 | if [ -z "$SECRET_KEY_BASE" ]; then 155 | # https://github.com/docker-library/redmine/issues/397 156 | # empty string is truthy in ruby and so masks the generated fallback config 157 | # https://github.com/rails/rails/blob/1aa9987169213ce5ce43c20b2643bc64c235e792/railties/lib/rails/application.rb#L454 158 | unset SECRET_KEY_BASE 159 | # generate SECRET_KEY_BASE in-file since it is not set or empty; this is not recommended unless the secret_token.rb is saved when container is recreated 160 | if [ ! -f config/initializers/secret_token.rb ]; then 161 | echo >&2 162 | echo >&2 'warning: no *SECRET_KEY_BASE set; running `rake generate_secret_token` to create one in "config/initializers/secret_token.rb"' 163 | echo >&2 164 | rake generate_secret_token 165 | fi 166 | fi 167 | 168 | if [ "$1" != 'rake' -a -z "$REDMINE_NO_DB_MIGRATE" ]; then 169 | rake db:migrate 170 | fi 171 | 172 | if [ "$1" != 'rake' -a -n "$REDMINE_PLUGINS_MIGRATE" ]; then 173 | rake redmine:plugins:migrate 174 | fi 175 | 176 | # remove PID file to enable restarting the container 177 | rm -f tmp/pids/server.pid 178 | fi 179 | 180 | exec "$@" 181 | -------------------------------------------------------------------------------- /6.1/alpine3.23/docker-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -Eeo pipefail 3 | # TODO add "-u" 4 | 5 | # usage: file_env VAR [DEFAULT] 6 | # ie: file_env 'XYZ_DB_PASSWORD' 'example' 7 | # (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of 8 | # "$XYZ_DB_PASSWORD" from a file, especially for Docker's secrets feature) 9 | file_env() { 10 | local var="$1" 11 | local fileVar="${var}_FILE" 12 | local def="${2:-}" 13 | if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then 14 | echo >&2 "error: both $var and $fileVar are set (but are exclusive)" 15 | exit 1 16 | fi 17 | local val="$def" 18 | if [ "${!var:-}" ]; then 19 | val="${!var}" 20 | elif [ "${!fileVar:-}" ]; then 21 | val="$(< "${!fileVar}")" 22 | fi 23 | export "$var"="$val" 24 | unset "$fileVar" 25 | } 26 | 27 | isLikelyRedmine= 28 | case "$1" in 29 | rails | rake ) isLikelyRedmine=1 ;; 30 | bundle ) if [ "${2:-}" = 'exec' ]; then isLikelyRedmine=1; fi ;; # https://github.com/docker-library/redmine/pull/386 - "bundle exec sidekiq" 31 | esac 32 | 33 | _fix_permissions() { 34 | # https://www.redmine.org/projects/redmine/wiki/RedmineInstall#Step-8-File-system-permissions 35 | local dirs=( config log public/*assets tmp ) args=() 36 | if [ "$(id -u)" = '0' ]; then 37 | args+=( ${args[@]:+,} '(' '!' -user redmine -exec chown redmine:redmine '{}' + ')' ) 38 | 39 | # https://github.com/docker-library/redmine/issues/268 - scanning "files" might be *really* expensive, so we should skip it if it seems like it's "already correct" 40 | local filesOwnerMode 41 | filesOwnerMode="$(stat -c '%U:%a' files)" 42 | if [ "$filesOwnerMode" != 'redmine:755' ]; then 43 | dirs+=( files ) 44 | fi 45 | fi 46 | # directories 755, files 644: 47 | args+=( ${args[@]:+,} '(' -type d '!' -perm 755 -exec sh -c 'chmod 755 "$@" 2>/dev/null || :' -- '{}' + ')' ) 48 | args+=( ${args[@]:+,} '(' -type f '!' -perm 644 -exec sh -c 'chmod 644 "$@" 2>/dev/null || :' -- '{}' + ')' ) 49 | find "${dirs[@]}" "${args[@]}" 50 | } 51 | 52 | # allow the container to be started with `--user` 53 | if [ -n "$isLikelyRedmine" ] && [ "$(id -u)" = '0' ]; then 54 | _fix_permissions 55 | exec gosu redmine "$BASH_SOURCE" "$@" 56 | fi 57 | 58 | if [ -n "$isLikelyRedmine" ]; then 59 | _fix_permissions 60 | if [ ! -f './config/database.yml' ]; then 61 | file_env 'REDMINE_DB_MYSQL' 62 | file_env 'REDMINE_DB_POSTGRES' 63 | file_env 'REDMINE_DB_SQLSERVER' 64 | 65 | if [ "$MYSQL_PORT_3306_TCP" ] && [ -z "$REDMINE_DB_MYSQL" ]; then 66 | export REDMINE_DB_MYSQL='mysql' 67 | elif [ "$POSTGRES_PORT_5432_TCP" ] && [ -z "$REDMINE_DB_POSTGRES" ]; then 68 | export REDMINE_DB_POSTGRES='postgres' 69 | fi 70 | 71 | if [ "$REDMINE_DB_MYSQL" ]; then 72 | adapter='mysql2' 73 | host="$REDMINE_DB_MYSQL" 74 | file_env 'REDMINE_DB_PORT' '3306' 75 | file_env 'REDMINE_DB_USERNAME' "${MYSQL_ENV_MYSQL_USER:-root}" 76 | file_env 'REDMINE_DB_PASSWORD' "${MYSQL_ENV_MYSQL_PASSWORD:-${MYSQL_ENV_MYSQL_ROOT_PASSWORD:-}}" 77 | file_env 'REDMINE_DB_DATABASE' "${MYSQL_ENV_MYSQL_DATABASE:-${MYSQL_ENV_MYSQL_USER:-redmine}}" 78 | file_env 'REDMINE_DB_ENCODING' '' 79 | elif [ "$REDMINE_DB_POSTGRES" ]; then 80 | adapter='postgresql' 81 | host="$REDMINE_DB_POSTGRES" 82 | file_env 'REDMINE_DB_PORT' '5432' 83 | file_env 'REDMINE_DB_USERNAME' "${POSTGRES_ENV_POSTGRES_USER:-postgres}" 84 | file_env 'REDMINE_DB_PASSWORD' "${POSTGRES_ENV_POSTGRES_PASSWORD}" 85 | file_env 'REDMINE_DB_DATABASE' "${POSTGRES_ENV_POSTGRES_DB:-${REDMINE_DB_USERNAME:-}}" 86 | file_env 'REDMINE_DB_ENCODING' 'utf8' 87 | elif [ "$REDMINE_DB_SQLSERVER" ]; then 88 | adapter='sqlserver' 89 | host="$REDMINE_DB_SQLSERVER" 90 | file_env 'REDMINE_DB_PORT' '1433' 91 | file_env 'REDMINE_DB_USERNAME' '' 92 | file_env 'REDMINE_DB_PASSWORD' '' 93 | file_env 'REDMINE_DB_DATABASE' '' 94 | file_env 'REDMINE_DB_ENCODING' '' 95 | else 96 | echo >&2 97 | echo >&2 'warning: missing REDMINE_DB_MYSQL, REDMINE_DB_POSTGRES, or REDMINE_DB_SQLSERVER environment variables' 98 | echo >&2 99 | echo >&2 '*** Using sqlite3 as fallback. ***' 100 | echo >&2 101 | 102 | adapter='sqlite3' 103 | host='localhost' 104 | file_env 'REDMINE_DB_PORT' '' 105 | file_env 'REDMINE_DB_USERNAME' 'redmine' 106 | file_env 'REDMINE_DB_PASSWORD' '' 107 | file_env 'REDMINE_DB_DATABASE' 'sqlite/redmine.db' 108 | file_env 'REDMINE_DB_ENCODING' 'utf8' 109 | 110 | mkdir -p "$(dirname "$REDMINE_DB_DATABASE")" 111 | if [ "$(id -u)" = '0' ]; then 112 | find "$(dirname "$REDMINE_DB_DATABASE")" \! -user redmine -exec chown redmine '{}' + 113 | fi 114 | fi 115 | 116 | REDMINE_DB_ADAPTER="$adapter" 117 | REDMINE_DB_HOST="$host" 118 | echo "$RAILS_ENV:" > config/database.yml 119 | for var in \ 120 | adapter \ 121 | host \ 122 | port \ 123 | username \ 124 | password \ 125 | database \ 126 | encoding \ 127 | ; do 128 | env="REDMINE_DB_${var^^}" 129 | val="${!env}" 130 | [ -n "$val" ] || continue 131 | if [ "$var" != 'adapter' ]; then 132 | # https://github.com/docker-library/redmine/issues/353 🙃 133 | val='"'"$val"'"' 134 | # (only add double quotes to every value *except* `adapter: xxx`) 135 | fi 136 | echo " $var: $val" >> config/database.yml 137 | done 138 | fi 139 | 140 | # install additional gems for Gemfile.local and plugins 141 | bundle check || bundle install 142 | 143 | file_env 'REDMINE_SECRET_KEY_BASE' 144 | # just use the rails variable rather than trying to put it into a yml file 145 | # https://github.com/rails/rails/blob/6-1-stable/railties/lib/rails/application.rb#L438 146 | # https://github.com/rails/rails/blob/1aa9987169213ce5ce43c20b2643bc64c235e792/railties/lib/rails/application.rb#L484 (rails 7.1-stable) 147 | if [ -n "${SECRET_KEY_BASE:-}" ] && [ -n "${REDMINE_SECRET_KEY_BASE:-}" ]; then 148 | echo >&2 149 | echo >&2 'warning: both SECRET_KEY_BASE and REDMINE_SECRET_KEY_BASE{_FILE} set, only SECRET_KEY_BASE will apply' 150 | echo >&2 151 | fi 152 | : "${SECRET_KEY_BASE:=${REDMINE_SECRET_KEY_BASE:-}}" 153 | export SECRET_KEY_BASE 154 | if [ -z "$SECRET_KEY_BASE" ]; then 155 | # https://github.com/docker-library/redmine/issues/397 156 | # empty string is truthy in ruby and so masks the generated fallback config 157 | # https://github.com/rails/rails/blob/1aa9987169213ce5ce43c20b2643bc64c235e792/railties/lib/rails/application.rb#L454 158 | unset SECRET_KEY_BASE 159 | # generate SECRET_KEY_BASE in-file since it is not set or empty; this is not recommended unless the secret_token.rb is saved when container is recreated 160 | if [ ! -f config/initializers/secret_token.rb ]; then 161 | echo >&2 162 | echo >&2 'warning: no *SECRET_KEY_BASE set; running `rake generate_secret_token` to create one in "config/initializers/secret_token.rb"' 163 | echo >&2 164 | rake generate_secret_token 165 | fi 166 | fi 167 | 168 | if [ "$1" != 'rake' -a -z "$REDMINE_NO_DB_MIGRATE" ]; then 169 | rake db:migrate 170 | fi 171 | 172 | if [ "$1" != 'rake' -a -n "$REDMINE_PLUGINS_MIGRATE" ]; then 173 | rake redmine:plugins:migrate 174 | fi 175 | 176 | # remove PID file to enable restarting the container 177 | rm -f tmp/pids/server.pid 178 | fi 179 | 180 | exec "$@" 181 | -------------------------------------------------------------------------------- /6.1/bookworm/docker-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -Eeo pipefail 3 | # TODO add "-u" 4 | 5 | # usage: file_env VAR [DEFAULT] 6 | # ie: file_env 'XYZ_DB_PASSWORD' 'example' 7 | # (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of 8 | # "$XYZ_DB_PASSWORD" from a file, especially for Docker's secrets feature) 9 | file_env() { 10 | local var="$1" 11 | local fileVar="${var}_FILE" 12 | local def="${2:-}" 13 | if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then 14 | echo >&2 "error: both $var and $fileVar are set (but are exclusive)" 15 | exit 1 16 | fi 17 | local val="$def" 18 | if [ "${!var:-}" ]; then 19 | val="${!var}" 20 | elif [ "${!fileVar:-}" ]; then 21 | val="$(< "${!fileVar}")" 22 | fi 23 | export "$var"="$val" 24 | unset "$fileVar" 25 | } 26 | 27 | isLikelyRedmine= 28 | case "$1" in 29 | rails | rake ) isLikelyRedmine=1 ;; 30 | bundle ) if [ "${2:-}" = 'exec' ]; then isLikelyRedmine=1; fi ;; # https://github.com/docker-library/redmine/pull/386 - "bundle exec sidekiq" 31 | esac 32 | 33 | _fix_permissions() { 34 | # https://www.redmine.org/projects/redmine/wiki/RedmineInstall#Step-8-File-system-permissions 35 | local dirs=( config log public/*assets tmp ) args=() 36 | if [ "$(id -u)" = '0' ]; then 37 | args+=( ${args[@]:+,} '(' '!' -user redmine -exec chown redmine:redmine '{}' + ')' ) 38 | 39 | # https://github.com/docker-library/redmine/issues/268 - scanning "files" might be *really* expensive, so we should skip it if it seems like it's "already correct" 40 | local filesOwnerMode 41 | filesOwnerMode="$(stat -c '%U:%a' files)" 42 | if [ "$filesOwnerMode" != 'redmine:755' ]; then 43 | dirs+=( files ) 44 | fi 45 | fi 46 | # directories 755, files 644: 47 | args+=( ${args[@]:+,} '(' -type d '!' -perm 755 -exec sh -c 'chmod 755 "$@" 2>/dev/null || :' -- '{}' + ')' ) 48 | args+=( ${args[@]:+,} '(' -type f '!' -perm 644 -exec sh -c 'chmod 644 "$@" 2>/dev/null || :' -- '{}' + ')' ) 49 | find "${dirs[@]}" "${args[@]}" 50 | } 51 | 52 | # allow the container to be started with `--user` 53 | if [ -n "$isLikelyRedmine" ] && [ "$(id -u)" = '0' ]; then 54 | _fix_permissions 55 | exec gosu redmine "$BASH_SOURCE" "$@" 56 | fi 57 | 58 | if [ -n "$isLikelyRedmine" ]; then 59 | _fix_permissions 60 | if [ ! -f './config/database.yml' ]; then 61 | file_env 'REDMINE_DB_MYSQL' 62 | file_env 'REDMINE_DB_POSTGRES' 63 | file_env 'REDMINE_DB_SQLSERVER' 64 | 65 | if [ "$MYSQL_PORT_3306_TCP" ] && [ -z "$REDMINE_DB_MYSQL" ]; then 66 | export REDMINE_DB_MYSQL='mysql' 67 | elif [ "$POSTGRES_PORT_5432_TCP" ] && [ -z "$REDMINE_DB_POSTGRES" ]; then 68 | export REDMINE_DB_POSTGRES='postgres' 69 | fi 70 | 71 | if [ "$REDMINE_DB_MYSQL" ]; then 72 | adapter='mysql2' 73 | host="$REDMINE_DB_MYSQL" 74 | file_env 'REDMINE_DB_PORT' '3306' 75 | file_env 'REDMINE_DB_USERNAME' "${MYSQL_ENV_MYSQL_USER:-root}" 76 | file_env 'REDMINE_DB_PASSWORD' "${MYSQL_ENV_MYSQL_PASSWORD:-${MYSQL_ENV_MYSQL_ROOT_PASSWORD:-}}" 77 | file_env 'REDMINE_DB_DATABASE' "${MYSQL_ENV_MYSQL_DATABASE:-${MYSQL_ENV_MYSQL_USER:-redmine}}" 78 | file_env 'REDMINE_DB_ENCODING' '' 79 | elif [ "$REDMINE_DB_POSTGRES" ]; then 80 | adapter='postgresql' 81 | host="$REDMINE_DB_POSTGRES" 82 | file_env 'REDMINE_DB_PORT' '5432' 83 | file_env 'REDMINE_DB_USERNAME' "${POSTGRES_ENV_POSTGRES_USER:-postgres}" 84 | file_env 'REDMINE_DB_PASSWORD' "${POSTGRES_ENV_POSTGRES_PASSWORD}" 85 | file_env 'REDMINE_DB_DATABASE' "${POSTGRES_ENV_POSTGRES_DB:-${REDMINE_DB_USERNAME:-}}" 86 | file_env 'REDMINE_DB_ENCODING' 'utf8' 87 | elif [ "$REDMINE_DB_SQLSERVER" ]; then 88 | adapter='sqlserver' 89 | host="$REDMINE_DB_SQLSERVER" 90 | file_env 'REDMINE_DB_PORT' '1433' 91 | file_env 'REDMINE_DB_USERNAME' '' 92 | file_env 'REDMINE_DB_PASSWORD' '' 93 | file_env 'REDMINE_DB_DATABASE' '' 94 | file_env 'REDMINE_DB_ENCODING' '' 95 | else 96 | echo >&2 97 | echo >&2 'warning: missing REDMINE_DB_MYSQL, REDMINE_DB_POSTGRES, or REDMINE_DB_SQLSERVER environment variables' 98 | echo >&2 99 | echo >&2 '*** Using sqlite3 as fallback. ***' 100 | echo >&2 101 | 102 | adapter='sqlite3' 103 | host='localhost' 104 | file_env 'REDMINE_DB_PORT' '' 105 | file_env 'REDMINE_DB_USERNAME' 'redmine' 106 | file_env 'REDMINE_DB_PASSWORD' '' 107 | file_env 'REDMINE_DB_DATABASE' 'sqlite/redmine.db' 108 | file_env 'REDMINE_DB_ENCODING' 'utf8' 109 | 110 | mkdir -p "$(dirname "$REDMINE_DB_DATABASE")" 111 | if [ "$(id -u)" = '0' ]; then 112 | find "$(dirname "$REDMINE_DB_DATABASE")" \! -user redmine -exec chown redmine '{}' + 113 | fi 114 | fi 115 | 116 | REDMINE_DB_ADAPTER="$adapter" 117 | REDMINE_DB_HOST="$host" 118 | echo "$RAILS_ENV:" > config/database.yml 119 | for var in \ 120 | adapter \ 121 | host \ 122 | port \ 123 | username \ 124 | password \ 125 | database \ 126 | encoding \ 127 | ; do 128 | env="REDMINE_DB_${var^^}" 129 | val="${!env}" 130 | [ -n "$val" ] || continue 131 | if [ "$var" != 'adapter' ]; then 132 | # https://github.com/docker-library/redmine/issues/353 🙃 133 | val='"'"$val"'"' 134 | # (only add double quotes to every value *except* `adapter: xxx`) 135 | fi 136 | echo " $var: $val" >> config/database.yml 137 | done 138 | fi 139 | 140 | # install additional gems for Gemfile.local and plugins 141 | bundle check || bundle install 142 | 143 | file_env 'REDMINE_SECRET_KEY_BASE' 144 | # just use the rails variable rather than trying to put it into a yml file 145 | # https://github.com/rails/rails/blob/6-1-stable/railties/lib/rails/application.rb#L438 146 | # https://github.com/rails/rails/blob/1aa9987169213ce5ce43c20b2643bc64c235e792/railties/lib/rails/application.rb#L484 (rails 7.1-stable) 147 | if [ -n "${SECRET_KEY_BASE:-}" ] && [ -n "${REDMINE_SECRET_KEY_BASE:-}" ]; then 148 | echo >&2 149 | echo >&2 'warning: both SECRET_KEY_BASE and REDMINE_SECRET_KEY_BASE{_FILE} set, only SECRET_KEY_BASE will apply' 150 | echo >&2 151 | fi 152 | : "${SECRET_KEY_BASE:=${REDMINE_SECRET_KEY_BASE:-}}" 153 | export SECRET_KEY_BASE 154 | if [ -z "$SECRET_KEY_BASE" ]; then 155 | # https://github.com/docker-library/redmine/issues/397 156 | # empty string is truthy in ruby and so masks the generated fallback config 157 | # https://github.com/rails/rails/blob/1aa9987169213ce5ce43c20b2643bc64c235e792/railties/lib/rails/application.rb#L454 158 | unset SECRET_KEY_BASE 159 | # generate SECRET_KEY_BASE in-file since it is not set or empty; this is not recommended unless the secret_token.rb is saved when container is recreated 160 | if [ ! -f config/initializers/secret_token.rb ]; then 161 | echo >&2 162 | echo >&2 'warning: no *SECRET_KEY_BASE set; running `rake generate_secret_token` to create one in "config/initializers/secret_token.rb"' 163 | echo >&2 164 | rake generate_secret_token 165 | fi 166 | fi 167 | 168 | if [ "$1" != 'rake' -a -z "$REDMINE_NO_DB_MIGRATE" ]; then 169 | rake db:migrate 170 | fi 171 | 172 | if [ "$1" != 'rake' -a -n "$REDMINE_PLUGINS_MIGRATE" ]; then 173 | rake redmine:plugins:migrate 174 | fi 175 | 176 | # remove PID file to enable restarting the container 177 | rm -f tmp/pids/server.pid 178 | fi 179 | 180 | exec "$@" 181 | -------------------------------------------------------------------------------- /Dockerfile.template: -------------------------------------------------------------------------------- 1 | {{ 2 | def is_alpine: 3 | env.variant | startswith("alpine") 4 | -}} 5 | {{ if is_alpine then ( -}} 6 | FROM ruby:{{ .ruby.version }}-{{ env.variant }} 7 | {{ ) else ( -}} 8 | FROM ruby:{{ .ruby.version }}-slim-{{ env.variant }} 9 | {{ ) end -}} 10 | 11 | # explicitly set uid/gid to guarantee that it won't change in the future 12 | # the values 999:999 are identical to the current user/group id assigned 13 | {{ if is_alpine then ( -}} 14 | # alpine already has a gid 999, so we'll use the next id 15 | RUN addgroup -S -g 1000 redmine && adduser -S -H -G redmine -u 999 redmine 16 | {{ ) else ( -}} 17 | RUN groupadd -r -g 999 redmine && useradd -r -g redmine -u 999 redmine 18 | {{ ) end -}} 19 | 20 | {{ 21 | [ 22 | # common packages 23 | "ca-certificates", 24 | "ghostscript", # for creating PDF thumbnails 25 | "git", 26 | "imagemagick", 27 | "mercurial", 28 | "openssh-client", 29 | "subversion", 30 | "tini", # grab tini for signal processing and zombie killing 31 | "wget", 32 | if is_alpine then 33 | # alpine packages 34 | "bash", 35 | "breezy", 36 | "findutils", 37 | "ghostscript-fonts", # for generating PNGs of Gantt charts 38 | "tzdata", 39 | empty 40 | else 41 | # debian packages 42 | "bzr", 43 | "gsfonts", # for generating PNGs of Gantt charts 44 | empty 45 | end 46 | ] | sort | ( 47 | -}} 48 | RUN set -eux; \ 49 | {{ if is_alpine then ( -}} 50 | apk add --no-cache \ 51 | {{ map( -}} 52 | {{ . }} \ 53 | {{ ) | add -}} 54 | ; 55 | {{ ) else ( -}} 56 | apt-get update; \ 57 | apt-get install -y --no-install-recommends \ 58 | {{ map( -}} 59 | {{ . }} \ 60 | {{ ) | add -}} 61 | ; \ 62 | {{ if env.variant == "bookworm" then ( -}} 63 | # allow imagemagick to use ghostscript for PDF -> PNG thumbnail conversion (4.1+) 64 | sed -ri 's/(rights)="none" (pattern="PDF")/\1="read" \2/' /etc/ImageMagick-6/policy.xml; \ 65 | {{ ) else "" end -}} 66 | rm -rf /var/lib/apt/lists/* 67 | {{ ) end -}} 68 | {{ ) -}} 69 | 70 | # grab gosu for easy step-down from root 71 | # https://github.com/tianon/gosu/releases 72 | ENV GOSU_VERSION 1.19 73 | RUN set -eux; \ 74 | \ 75 | {{ if is_alpine then ( -}} 76 | apk add --no-cache --virtual .gosu-deps \ 77 | dpkg \ 78 | gnupg \ 79 | ; \ 80 | {{ ) else ( -}} 81 | savedAptMark="$(apt-mark showmanual)"; \ 82 | apt-get update; \ 83 | apt-get install -y --no-install-recommends \ 84 | gnupg \ 85 | ; \ 86 | rm -rf /var/lib/apt/lists/*; \ 87 | {{ ) end -}} 88 | \ 89 | dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')"; \ 90 | wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch"; \ 91 | wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch.asc"; \ 92 | export GNUPGHOME="$(mktemp -d)"; \ 93 | gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4; \ 94 | gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu; \ 95 | gpgconf --kill all; \ 96 | rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc; \ 97 | \ 98 | {{ if is_alpine then ( -}} 99 | apk del --no-network .gosu-deps; \ 100 | {{ ) else ( -}} 101 | apt-mark auto '.*' > /dev/null; \ 102 | apt-mark manual $savedAptMark > /dev/null; \ 103 | apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ 104 | {{ ) end -}} 105 | \ 106 | # smoke test 107 | chmod +x /usr/local/bin/gosu; \ 108 | gosu --version; \ 109 | gosu nobody true 110 | {{ if is_alpine and (env.version | IN("5.1")) then ( -}} 111 | RUN set -eux; ln -svf gosu /usr/local/bin/su-exec; su-exec nobody true # backwards compatibility (removed in Redmine 5.2+) 112 | {{ ) else "" end -}} 113 | 114 | ENV RAILS_ENV production 115 | WORKDIR /usr/src/redmine 116 | 117 | # https://github.com/docker-library/redmine/issues/138#issuecomment-438834176 118 | # (bundler needs this for running as an arbitrary user) 119 | ENV HOME /home/redmine 120 | RUN set -eux; \ 121 | [ ! -d "$HOME" ]; \ 122 | mkdir -p "$HOME"; \ 123 | chown redmine:redmine "$HOME"; \ 124 | chmod 1777 "$HOME" 125 | 126 | ENV REDMINE_VERSION {{ .version }} 127 | ENV REDMINE_DOWNLOAD_URL {{ .downloadUrl }} 128 | ENV REDMINE_DOWNLOAD_SHA256 {{ .sha256 }} 129 | ENV RAILS_LOG_TO_STDOUT true 130 | 131 | RUN set -eux; \ 132 | wget -O redmine.tar.gz "$REDMINE_DOWNLOAD_URL"; \ 133 | echo "$REDMINE_DOWNLOAD_SHA256 *redmine.tar.gz" | sha256sum -c -; \ 134 | tar -xf redmine.tar.gz --strip-components=1; \ 135 | rm redmine.tar.gz files/delete.me log/delete.me; \ 136 | # https://www.redmine.org/projects/redmine/wiki/RedmineInstall#Step-8-File-system-permissions 137 | set -- {{ 138 | [ 139 | "config", # database.yml created by the entrypoint and secret_token.rb if not using SECRET_KEY_BASE 140 | "db", # schema.rb is created/edited during 'rake db:migrate' 141 | "sqlite", # database dir when using sqlite 142 | "tmp/pids", # pid file location 143 | 144 | # from RedmineInstall instructions 145 | "log", 146 | "tmp", 147 | "tmp/pdf", 148 | if (env.version | IN("5.1")) then 149 | "public/plugin_assets" 150 | else 151 | "public/assets" 152 | end, 153 | empty 154 | | @sh 155 | ] 156 | | sort 157 | | join(" ") 158 | }}; \ 159 | mkdir -p "$@"; \ 160 | chown -R redmine:redmine ./; \ 161 | # fix permissions for running as an arbitrary user 162 | chmod -R ugo=rwX "$@"; \ 163 | find "$@" -type d -exec chmod 1777 '{}' + 164 | 165 | {{ if is_alpine and IN(env.version; "5.1", "6.0") then ( -}} 166 | # build for musl-libc, not glibc (see https://github.com/sparklemotion/nokogiri/issues/2075, https://github.com/rubygems/rubygems/issues/3174) 167 | ENV BUNDLE_FORCE_RUBY_PLATFORM 1 168 | {{ ) else "" end -}} 169 | {{ 170 | [ 171 | # common packages 172 | "freetds-dev", 173 | "gcc", 174 | "make", 175 | "patch", 176 | if is_alpine then 177 | # alpine packages 178 | "coreutils", # required because "chmod +X" in busybox will remove +x on files (and coreutils leaves files alone with +X) 179 | "mariadb-dev", 180 | "musl-dev", 181 | "postgresql-dev", 182 | "yaml-dev", 183 | if IN(env.version; "5.1", "6.0") then 184 | "sqlite-dev", 185 | "ttf2ufm", 186 | "zlib-dev", 187 | empty 188 | else 189 | # 6.1+ needs to compile some extensions on non-amd64-non-arm64 architectures 190 | "cargo", 191 | "clang19-dev", # TODO the dep needing libclang.so doesn't seem to care what version, so maybe there's a more generic dep we could use here? 192 | empty 193 | end, 194 | empty 195 | else 196 | # debian packages 197 | "default-libmysqlclient-dev", 198 | "libpq-dev", 199 | "libsqlite3-dev", 200 | "libxml2-dev", 201 | "libxslt-dev", 202 | "libyaml-dev", 203 | "pkgconf", 204 | "xz-utils", 205 | if IN(env.version; "5.1", "6.0") then empty else 206 | # 6.1+ needs to compile some extensions on non-amd64-non-arm64 architectures 207 | "cargo", 208 | "libclang-dev", 209 | empty 210 | end, 211 | empty 212 | end 213 | ] | sort | ( 214 | -}} 215 | RUN set -eux; \ 216 | {{ if is_alpine then ( -}} 217 | apk add --no-cache --virtual .build-deps \ 218 | {{ map( -}} 219 | {{ . }} \ 220 | {{ ) | add -}} 221 | ; \ 222 | {{ ) else ( -}} 223 | savedAptMark="$(apt-mark showmanual)"; \ 224 | apt-get update; \ 225 | apt-get install -y --no-install-recommends \ 226 | {{ map( -}} 227 | {{ . }} \ 228 | {{ ) | add -}} 229 | ; \ 230 | rm -rf /var/lib/apt/lists/*; \ 231 | {{ ) end -}} 232 | {{ ) -}} 233 | \ 234 | gosu redmine bundle config --local without 'development test'; \ 235 | # https://github.com/redmine/redmine/commit/23dc108e70a0794f444803ac827a690085dcd557 236 | # ("gem puma" already exists in the Gemfile, but under "group :test" and we want it all the time) 237 | puma="$(grep -E "^[[:space:]]*gem [:'\"]puma['\",[:space:]].*\$" Gemfile)"; \ 238 | { echo; echo "$puma"; } | sed -re 's/^[[:space:]]+//' >> Gemfile; \ 239 | # fill up "database.yml" with bogus entries so the redmine Gemfile will pre-install all database adapter dependencies 240 | # https://github.com/redmine/redmine/blob/e9f9767089a4e3efbd73c35fc55c5c7eb85dd7d3/Gemfile#L50-L79 241 | echo '# the following entries only exist to force `bundle install` to pre-install all database adapter dependencies -- they can be safely removed/ignored' > ./config/database.yml; \ 242 | for adapter in mysql2 postgresql sqlserver sqlite3; do \ 243 | echo "$adapter:" >> ./config/database.yml; \ 244 | echo " adapter: $adapter" >> ./config/database.yml; \ 245 | done; \ 246 | {{ if is_alpine then "" else ( -}} 247 | # nokogiri's vendored libxml2 + libxslt do not build on mips64le, so use the apt packages when building 248 | gosu redmine bundle config build.nokogiri --use-system-libraries; \ 249 | {{ ) end -}} 250 | gosu redmine bundle install --jobs "$(nproc)"; \ 251 | rm ./config/database.yml; \ 252 | # fix permissions for running as an arbitrary user 253 | chmod -R ugo=rwX Gemfile.lock "$GEM_HOME"; \ 254 | rm -rf ~redmine/.bundle; \ 255 | \ 256 | {{ if is_alpine then ( -}} 257 | # https://github.com/naitoh/rbpdf/issues/31 258 | rm /usr/local/bundle/gems/rbpdf-font-1.19.*/lib/fonts/ttf2ufm/ttf2ufm; \ 259 | \ 260 | runDeps="$( \ 261 | scanelf --needed --nobanner --format '%n#p' --recursive /usr/local/bundle/gems \ 262 | | tr ',' '\n' \ 263 | | sort -u \ 264 | | awk ' \ 265 | {{ if IN(env.version; "5.1", "6.0") then "" else ( -}} 266 | $1 == "libc.so" { next } \ 267 | {{ ) end -}} 268 | system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } \ 269 | { print "so:" $1 } \ 270 | ' \ 271 | )"; \ 272 | apk add --no-network --virtual .redmine-rundeps $runDeps; \ 273 | apk del --no-network .build-deps 274 | {{ ) else ( -}} 275 | # reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies 276 | apt-mark auto '.*' > /dev/null; \ 277 | [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ 278 | find /usr/local -type f -executable -exec ldd '{}' ';' \ 279 | | awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); printf "*%s\n", so }' \ 280 | | sort -u \ 281 | | xargs -rt dpkg-query --search \ 282 | # https://manpages.debian.org/trixie/dpkg/dpkg-query.1.en.html#S (we ignore diversions and it'll be really unusual for more than one package to provide any given .so file) 283 | | awk 'sub(":$", "", $1) { print $1 }' \ 284 | | sort -u \ 285 | | xargs -r apt-mark manual \ 286 | ; \ 287 | apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false 288 | {{ ) end -}} 289 | 290 | VOLUME /usr/src/redmine/files 291 | 292 | COPY docker-entrypoint.sh / 293 | ENTRYPOINT ["/docker-entrypoint.sh"] 294 | 295 | EXPOSE 3000 296 | CMD ["rails", "server", "-b", "0.0.0.0"] 297 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | 294 | Copyright (C) 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | , 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. 340 | --------------------------------------------------------------------------------