|
| 1 | +# |
| 2 | +# Copyright (c) 2021 Matthew Penner |
| 3 | +# |
| 4 | +# Permission is hereby granted, free of charge, to any person obtaining a copy |
| 5 | +# of this software and associated documentation files (the "Software"), to deal |
| 6 | +# in the Software without restriction, including without limitation the rights |
| 7 | +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 8 | +# copies of the Software, and to permit persons to whom the Software is |
| 9 | +# furnished to do so, subject to the following conditions: |
| 10 | +# |
| 11 | +# The above copyright notice and this permission notice shall be included in all |
| 12 | +# copies or substantial portions of the Software. |
| 13 | +# |
| 14 | +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 15 | +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 16 | +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 17 | +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 18 | +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 19 | +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 20 | +# SOFTWARE. |
| 21 | +# |
| 22 | + |
| 23 | +FROM --platform=$TARGETOS/$TARGETARCH debian:latest |
| 24 | +ARG TARGETARCH |
| 25 | + |
| 26 | +LABEL author= "Matthew Penner" maintainer= "[email protected]" |
| 27 | + |
| 28 | +LABEL org.opencontainers.image.source="https://github.com/Soapy7261/yolks" |
| 29 | +LABEL org.opencontainers.image.licenses=MIT |
| 30 | + |
| 31 | +COPY ./../entrypoint-thanos.sh /entrypoint.sh |
| 32 | +COPY ./../install_composer.sh /composer_install.sh |
| 33 | +COPY ./../hash_check.sh /hash_check.sh |
| 34 | + |
| 35 | +ENV DEBIAN_FRONTEND=noninteractive |
| 36 | +ENV COMPOSER_ALLOW_SUPERUSER=1 |
| 37 | + |
| 38 | +RUN apt-get update -y && apt-get install -y apt-transport-https lsb-release ca-certificates curl git \ |
| 39 | + && apt-get upgrade -y \ |
| 40 | + && useradd -d /home/container -m container && chmod +x /entrypoint.sh && chown container /entrypoint.sh \ |
| 41 | + # Install GraalVM |
| 42 | + && if [ "${TARGETARCH}" = "amd64" ]; then \ |
| 43 | + echo "Installing GraalVM for x86_64 architecture"; \ |
| 44 | + curl -o /graalvm.tar.gz https://download.oracle.com/graalvm/20/latest/graalvm-jdk-20_linux-x64_bin.tar.gz; \ |
| 45 | + elif [ "${TARGETARCH}" = "arm64" ]; then \ |
| 46 | + echo "Installing GraalVM for aarch64 architecture"; \ |
| 47 | + curl -o /graalvm.tar.gz https://download.oracle.com/graalvm/20/latest/graalvm-jdk-20_linux-aarch64_bin.tar.gz; \ |
| 48 | + else \ |
| 49 | + echo "Unsupported architecture: ${TARGETARCH}"; exit 1; \ |
| 50 | + fi \ |
| 51 | + # Check SHA256 to make sure its not corrupted |
| 52 | + && /bin/bash /hash_check.sh 20 && rm /hash_check.sh \ |
| 53 | + && mkdir /graalvm && tar -xzf /graalvm.tar.gz -C /graalvm --strip-components=1 \ |
| 54 | + && chown -R container /graalvm && chmod +x /graalvm/bin/java \ |
| 55 | + && chmod -R 755 /graalvm && rm /graalvm.tar.gz \ |
| 56 | + # Install PHP |
| 57 | + && curl -o /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg \ |
| 58 | + && echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | tee /etc/apt/sources.list.d/php.list \ |
| 59 | + && apt-get update -y && apt-get install -y php8.1 \ |
| 60 | + && /bin/bash /composer_install.sh && rm /composer_install.sh \ |
| 61 | + && mkdir /thanos && chown container /thanos && cd /thanos && composer require aternos/thanos \ |
| 62 | + # Remove the packages we dont need anymore |
| 63 | + && apt-get remove -y apt-transport-https lsb-release ca-certificates curl git \ |
| 64 | + && apt-get autoremove -y && rm -rf /var/lib/apt/lists/* |
| 65 | + |
| 66 | +ENV DEBIAN_FRONTEND=dialog |
| 67 | +USER container |
| 68 | +ENV USER=container HOME=/home/container |
| 69 | +WORKDIR /home/container |
| 70 | +ENV JAVA_HOME="/graalvm" |
| 71 | +ENV PATH="$JAVA_HOME/bin:$PATH" |
| 72 | + |
| 73 | +CMD [ "/bin/bash", "/entrypoint.sh" ] |
0 commit comments