Skip to content

Commit

Permalink
Merge pull request #603 from dbarzin/dev
Browse files Browse the repository at this point in the history
Fix docker migration
  • Loading branch information
dbarzin authored Jan 22, 2024
2 parents 8771fb4 + 604681d commit 47d56d5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
14 changes: 8 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ RUN apk add php8-zip \
php8-fileinfo \
php8-simplexml php8-xml php8-xmlreader php8-xmlwriter \
php8-tokenizer

RUN apk update && \
apk add --no-cache \
libzip-dev \
Expand All @@ -45,30 +45,32 @@ RUN curl -sS https://getcomposer.org/installer | php \
COPY . /var/www/mercator
WORKDIR /var/www/mercator

# the sqlite file must exist
# RUN touch ${DB_DATABASE}

# add mercator:www user
RUN addgroup --g 1000 -S www && \
adduser -u 1000 -S mercator -G www && \
chown -R mercator:www /var/www /var/lib/nginx /var/log/nginx /etc/nginx/http.d

# COPY nginx.conf /etc/nginx/http.d/mercator.conf
# RUN chown -R mercator:www
# RUN chown -R mercator:www

RUN cp docker/nginx.conf /etc/nginx/http.d/default.conf
RUN cp docker/supervisord.conf /etc/supervisord.conf
RUN chown -R mercator:www /etc/nginx/http.d/default.conf
RUN chown -R mercator:www /etc/supervisord.conf


USER mercator:www

# Install mercator deps
RUN set -ex ; \
composer -n validate --strict ; \
composer -n install --no-scripts --ignore-platform-reqs --no-dev

# Publish Laravel Vendor resources
RUN php artisan vendor:publish --all

# Install passport
RUN php artisan passport:install

EXPOSE 8000

CMD ["/usr/bin/supervisord", "-c", "/etc/supervisord.conf"]
8 changes: 2 additions & 6 deletions docker/supervisord.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,10 @@ nodaemon=true

[program:migrate]
command=/bin/sh -c '
php artisan vendor:publish --provider="Laravel\Sanctum\SanctumServiceProvider"
php artisan migrate --force;
if [ ! -s ${DB_DATABASE} ];
then
touch ${DB_DATABASE} && chmod a+x ${DB_DATABASE} &&
(php artisan migrate --force) &&
(php artisan db:seed --force && php artisan passport:install);
else
php artisan migrate;
php artisan db:seed --force;
fi;
touch /tmp/migrated'
autorestart=false
Expand Down

0 comments on commit 47d56d5

Please sign in to comment.