Skip to content

Commit

Permalink
Added files for Docker
Browse files Browse the repository at this point in the history
  • Loading branch information
cp6 committed Apr 21, 2023
1 parent 9f96cbf commit 29e035f
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM php:8.2-fpm-alpine

RUN docker-php-ext-install pdo pdo_mysql sockets
RUN curl -sS https://getcomposer.org/installer | php -- \
--install-dir=/usr/local/bin --filename=composer

COPY --from=composer:latest /usr/bin/composer /usr/bin/composer

WORKDIR /app
COPY . .
RUN composer install

ENV APP_ENV production
ENTRYPOINT ["/app/run.sh"]
22 changes: 22 additions & 0 deletions run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/sh

# Run setup only if .env file doesn't exist.
if [ ! -e .env.production ]
then
cat > .env.production << EOF
APP_NAME=Surcuri
APP_DEBUG=false
APP_KEY=
DB_CONNECTION=mysql
DB_HOST=${DB_HOST}
DB_DATABASE=${DB_DATABASE}
DB_USERNAME=${DB_USERNAME}
DB_PASSWORD=${DB_PASSWORD}
APP_URL=${APP_URL}
EOF
php artisan key:generate --no-interaction --force
fi

# php artisan migrate:fresh --seed
php artisan serve --host=0.0.0.0 --port=8000 --env=production

0 comments on commit 29e035f

Please sign in to comment.