Skip to content

Commit

Permalink
Merge pull request #569 from turbo124/master
Browse files Browse the repository at this point in the history
Set react as default interface
  • Loading branch information
turbo124 authored Apr 4, 2024
2 parents 1a1cea6 + 0fab603 commit 59616ea
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 48 deletions.
58 changes: 14 additions & 44 deletions alpine/5/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ FROM --platform=$BUILDPLATFORM node:lts-alpine as nodebuild

# Download Invoice Ninja
ARG INVOICENINJA_VERSION
# ADD https://github.com/invoiceninja/invoiceninja/tarball/v$INVOICENINJA_VERSION /tmp/ninja.tar.gz
ADD https://github.com/invoiceninja/invoiceninja/releases/download/v$INVOICENINJA_VERSION/react-invoiceninja.tar /tmp/ninja.tar

RUN set -eux; apk add curl unzip
Expand All @@ -17,37 +16,11 @@ RUN mkdir -p /var/www/app \
&& tar -xvf /tmp/ninja.tar -C /var/www/app/ \
&& mkdir -p /var/www/app/public/logo /var/www/app/storage

WORKDIR /var/www/app

RUN rm -f /var/www/app/public/main.*
RUN rm -f /var/www/app/public/flutter*

# Download and extract the latest react application
# RUN curl -LGO $(curl https://api.github.com/repos/invoiceninja/ui/releases/latest | grep "browser_download_url" | awk '{ print $2 }' | sed 's/,$//' | sed 's/"//g');
# RUN cp invoiceninja-react.zip /tmp/invoiceninja-react.zip
# RUN unzip /tmp/invoiceninja-react.zip
# RUN mkdir /var/www/app/public/react/v$INVOICENINJA_VERSION/
# RUN cp -r dist/react/* /var/www/app/public/react/v$INVOICENINJA_VERSION/
# RUN cp -r dist/react/* /var/www/app/public/react/

# RUN mkdir -p /var/www/app/public/tinymce_6.4.2/tinymce/js/
# RUN cp -r dist/tinymce_6.4.2/* /var/www/app/public/tinymce_6.4.2/


# WORKDIR /var/www/app

# RUN git clone https://github.com/invoiceninja/ui.git

# WORKDIR /var/www/app/ui

# RUN git checkout develop
# RUN npm i
# RUN npm run build
# RUN cp -r dist/* /var/www/app/public/


# WORKDIR /var/www/app

# Download and extract the latest react application
#
# Prepare php image
FROM php:${PHP_VERSION}-fpm-alpine as phpbuild

Expand Down Expand Up @@ -99,6 +72,8 @@ RUN addgroup --gid=$UID -S "$INVOICENINJA_USER" \
--ingroup "$INVOICENINJA_USER" \
"$INVOICENINJA_USER"

WORKDIR /var/www/app

# Set up app
ARG INVOICENINJA_VERSION
ARG BAK_STORAGE_PATH
Expand All @@ -110,33 +85,28 @@ COPY --from=nodebuild --chown=$INVOICENINJA_USER:$INVOICENINJA_USER /var/www/app

RUN rm -f /var/www/app/public/main.*
RUN rm -f /var/www/app/public/flutter*
RUN rm -rf /var/www/app/ui

USER $UID
WORKDIR /var/www/app

# Do not remove this ENV
ENV IS_DOCKER true
# RUN /usr/local/bin/composer install --no-dev --no-scripts --no-interaction
# RUN /usr/local/bin/composer dump-autoload --optimize --no-dev --classmap-authoritative --no-scripts --no-interaction

# FROM --platform=$BUILDPLATFORM nodebuild AS dependencybuild

# WORKDIR /var/www/app
FROM --platform=$BUILDPLATFORM nodebuild AS dependencybuild

# COPY --from=phpbuild /var/www/app/vendor /var/www/app/vendor
WORKDIR /var/www/app
COPY --from=phpbuild /var/www/app /var/www/app

# # Install node packages
# ARG BAK_STORAGE_PATH
# ARG BAK_PUBLIC_PATH
# RUN --mount=target=/var/www/app/node_modules,type=cache \
# npm install \
# && npm run production \
# && mv /var/www/app/storage $BAK_STORAGE_PATH \
# && mv /var/www/app/public $BAK_PUBLIC_PATH
ARG BAK_STORAGE_PATH
ARG BAK_PUBLIC_PATH

RUN mv /var/www/app/storage $BAK_STORAGE_PATH \
&& mv /var/www/app/public $BAK_PUBLIC_PATH

FROM phpbuild as prod

# COPY --from=dependencybuild --chown=$INVOICENINJA_USER:$INVOICENINJA_USER /var/www/app /var/www/app
COPY --from=dependencybuild --chown=$INVOICENINJA_USER:$INVOICENINJA_USER /var/www/app /var/www/app

# Override the environment settings from projects .env file
ENV APP_ENV production
Expand Down
3 changes: 1 addition & 2 deletions alpine/5/rootfs/docker-entrypoint-init.d/10-init-in.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,4 @@ if [[ ! -z "${IN_PASSWORD}" ]]; then
password="--password ${IN_PASSWORD}"
fi

php artisan ninja:create-account $email $password
php artisan ninja:react
php artisan ninja:create-account $email $password
1 change: 0 additions & 1 deletion alpine/5/rootfs/usr/local/bin/invoiceninja-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ docker_process_init_files() {
php artisan config:cache
php artisan optimize
php artisan package:discover
php artisan ninja:react

# Check if DB works, if not crash the app.
DB_READY=$(php artisan tinker --execute='echo app()->call("App\Utils\SystemHealth@dbCheck")["success"];')
Expand Down
2 changes: 1 addition & 1 deletion config/nginx/in-vhost.conf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ server {
client_max_body_size 100M;

root /var/www/app/public/;
index index.php;
index index.html index.htm index.php;

location / {
try_files $uri $uri/ /index.php?$query_string;
Expand Down

0 comments on commit 59616ea

Please sign in to comment.