Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Update Laravel #212

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ services:
- ./laravel:/var/www
- ./.env:/var/www/.env
- vendor:/var/www/vendor
- node_modules:/var/www/node_modules
networks:
- app-network
depends_on:
Expand All @@ -29,6 +28,7 @@ services:
volumes:
- ./laravel/:/var/www
- ./nginx/conf.d/app.conf:/etc/nginx/conf.d/default.conf
- node_modules:/var/www/node_modules
networks:
- app-network
depends_on:
Expand Down Expand Up @@ -66,9 +66,10 @@ services:

# MySQL Service
db:
image: mysql:5.7.22
image: mariadb
container_name: voldb-mysql
restart: unless-stopped
command: mysqld --sql_mode=""
tty: true
ports:
- "3307:3306"
Expand All @@ -81,7 +82,6 @@ services:
SERVICE_NAME: mysql
volumes:
- dbdata:/var/lib/mysql
- ./mysql/setup.sql:/docker-entrypoint-initdb.d/setup.sql
networks:
- app-network

Expand Down
55 changes: 31 additions & 24 deletions laravel/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,41 +1,48 @@
FROM php:7.1.3-fpm

# Move files over
COPY composer.lock composer.json /var/www/
FROM php:7.3-fpm-alpine

# Set working directory
WORKDIR /var/www

RUN apt-get update && apt-get install -y libmcrypt-dev git zip unzip apt-utils\
mysql-client libmagickwand-dev --no-install-recommends \
&& pecl install imagick \
&& docker-php-ext-enable imagick\
&& docker-php-ext-install mcrypt pdo_mysql mbstring dom zip

RUN curl -sL https://deb.nodesource.com/setup_10.x | bash -\
&& apt-get install -y nodejs
RUN apk add --no-cache \
git \
bash \
nodejs \
npm \
freetype \
libjpeg-turbo \
libpng \
freetype-dev \
libjpeg-turbo-dev \
libpng-dev \
&& docker-php-ext-configure gd \
--with-freetype-dir=/usr/include \
--with-jpeg-dir=/usr/include \
&& docker-php-ext-install -j$(nproc) gd \
&& docker-php-ext-enable gd \
&& apk del --no-cache \
freetype-dev \
libjpeg-turbo-dev \
libpng-dev \
&& rm -rf /tmp/*

RUN apk add libzip-dev \
&& docker-php-ext-install pdo pdo_mysql zip bcmath

# Add user for laravel application
RUN groupadd -g 1000 homestead
RUN useradd -u 1000 -ms /bin/bash -g homestead homestead
RUN addgroup -S -g 1000 homestead && adduser -u 1000 -S -G homestead homestead

# You're awesome. Just own it
COPY . /var/www
RUN chown -R homestead:homestead /var/www
COPY --chown=homestead:homestead . /var/www

# Set up composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer --version=1.10.16
RUN composer install
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer --version=2.0.2
COPY composer.lock composer.json /var/www/
RUN composer update --no-scripts && composer install

# Make sure we have access
RUN mkdir -p /usr/lib/node_modules
RUN chown -R homestead:homestead /usr/lib/node_modules
COPY resources/js/config.example.js resources/js/config.js
RUN npm install && npm run build

# Do our dirty work
RUN npm install
RUN npm run build

USER homestead

# Expose port 9000 and start php-fpm server
Expand Down
10 changes: 5 additions & 5 deletions laravel/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
"license": "MIT",
"type": "project",
"require": {
"php": ">=7.1.3",
"laravel/framework": "5.6.*",
"laravelcollective/html": "^5.6",
"php": "^7.2",
"laravel/framework": "6.x",
"laravelcollective/html": "^6.0",
"predis/predis": "^1.1",
"doctrine/dbal": "^2.6"
"doctrine/dbal": "2.9.3"
},
"require-dev": {
"fzaninotto/faker": "~1.7",
"fakerphp/faker": "^1.3",
"mockery/mockery": "^1.0",
"phpunit/phpunit": "^7.0"
},
Expand Down
Loading