ncc/Dockerfile

71 lines
3.1 KiB
Text
Raw Normal View History

# Copyright 2022-2023 Nosial - All Rights Reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
# documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
# Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# ncc in Docker
#
# This image is intended to be used as a base for projects using ncc.
#
2023-03-02 12:57:27 +00:00
#
# Builder stage: downloads necessary files and serves them on a silver platter.
#
2023-07-12 17:28:48 +00:00
FROM php:8.1-fpm AS builder
2023-03-02 13:16:00 +00:00
WORKDIR /tmp
# Install some stuff the default image doesn't come with
RUN apt update -yqq; \
apt install git libpq-dev libzip-dev zip make wget gnupg -yqq
2023-03-03 04:48:31 +00:00
# Download phive and install phab
RUN wget -O phive.phar https://phar.io/releases/phive.phar; \
wget -O phive.phar.asc https://phar.io/releases/phive.phar.asc; \
gpg --keyserver hkps://keys.openpgp.org --recv-keys 0x9D8A98B29B2D5D79; \
gpg --verify phive.phar.asc phive.phar; \
2023-03-03 04:56:25 +00:00
rm phive.phar.asc; chmod +x phive.phar; ./phive.phar install phpab --global --trust-gpg-keys 0x2A8299CE842DD38C
2023-03-02 12:57:27 +00:00
# Download the latest version of ncc (Nosial Code Compiler)
2023-03-02 13:23:51 +00:00
RUN git clone https://git.n64.cc/nosial/ncc.git; \
cd ncc; make redist
2023-03-02 12:57:27 +00:00
#
# Main stage: Copies downloaded files and installs all
#
FROM php:8.1-fpm
2023-03-02 12:57:27 +00:00
2023-03-03 04:48:31 +00:00
# Add extensions
ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/
2023-03-02 12:57:27 +00:00
# Copy downloaded files
2023-03-02 13:16:00 +00:00
COPY --from=builder /tmp/. .
2023-03-02 12:57:27 +00:00
2023-03-03 04:48:31 +00:00
# Install extensions required to run ncc
RUN install-php-extensions mbstring \
ctype \
common; \
# Add git
apt install -y git; \
2023-03-08 07:55:13 +00:00
2023-03-06 12:25:23 +00:00
# Install phive, phab and ncc; create workdir
2023-03-03 04:48:31 +00:00
chmod +x phive.phar; \
2023-03-02 12:57:27 +00:00
mv phive.phar /usr/local/bin/phive; \
phive install phpab --global --trust-gpg-keys 0x2A8299CE842DD38C; \
2023-03-06 12:25:23 +00:00
cd ncc; php build/src/INSTALL --auto --install-composer; cd ..; rm -rf ncc; \
mkdir /app
WORKDIR /app