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

Different configuration for Docker - Need Help #83

Closed
ClaudioRojasA opened this issue Aug 5, 2020 · 5 comments
Closed

Different configuration for Docker - Need Help #83

ClaudioRojasA opened this issue Aug 5, 2020 · 5 comments
Labels

Comments

@ClaudioRojasA
Copy link

Hello, i'm doing a project at a class and they required i use this template to work with laravel and Docker, but also told me i have to use Debian Buster and apache, so i wanted to know how i would go about modifying the dockerfile and dockercompose to match what im being asked to do or if i should install without docker and create my own dockerfile but a simpler versión to run the code.
I would appreciate any help because my teachers haven't really taught us how to use docker but we need to use it.

@r-brown
Copy link
Member

r-brown commented Aug 6, 2020

Hello @ClaudeTheRed

this is the place where you can change OS (e.g. Debian Buster) for Docker
https://github.com/Labs64/laravel-boilerplate/blob/master/dockerfiles/Dockerfile#L1

this is the place where you can change HTTP server (e.g. Apache)
https://github.com/Labs64/laravel-boilerplate/blob/master/docker-compose.yml#L26

Hope this helps.

@r-brown r-brown closed this as completed Aug 6, 2020
@ClaudioRojasA
Copy link
Author

ClaudioRojasA commented Aug 7, 2020

Hello @ClaudeTheRed

this is the place where you can change OS (e.g. Debian Buster) for Docker
https://github.com/Labs64/laravel-boilerplate/blob/master/dockerfiles/Dockerfile#L1

this is the place where you can change HTTP server (e.g. Apache)
https://github.com/Labs64/laravel-boilerplate/blob/master/docker-compose.yml#L26

Hope this helps.

Hello, i'm trying to do what you said, but i wonder if what im doing it's alright, cause it's something i haven't used before so a lot of things i just have never heard of.

This is how i modified the dockerfile:
FROM debian:buster

Install some must-haves

RUN apt-get install -y vim wget sendmail
RUN apt-get install -y git
RUN git --version

Install PHP 7.2 on Buster

RUN apt-get install -y php7.3
RUN php -v

RUN apt-get install -y
php
php-bcmath
php-cli
php-common
php-curl
php-fpm
php-gd
php-ldap
php-intl
php-mbstring
php-mysqlnd
php-opcache
php-pdo
php-pear
php-pecl-apcu
php-pgsql
php-process
php-recode
php-soap
php-xml
php-zip

#RUN apt-get install -y php-imap php-mcrypt php-pecl-imagick php-pspell php-tidy

Prepare PHP environment

COPY config/php/php-fpm.conf /etc/php-fpm.conf
COPY config/php/www.conf /etc/php-fpm.d/www.conf
COPY config/php/php.ini /usr/local/etc/php/php.ini
COPY config/php/xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini

Install Composer

RUN curl -sS https://getcomposer.org/installer | php
RUN mv composer.phar /usr/bin/composer
RUN composer --version

Install Node.js

RUN apt-get install -y nodejs
RUN node -v

Final update and clean up

#RUN yum -y update
#RUN yum clean all

Define work directory

WORKDIR /var/www/laravel-boilerplate

Expose ports

EXPOSE 9000

CMD ["php-fpm", "-F", "-O"]

This is how i modified the docker-compose.yml
version: '3'
services:
mysql:
image: mysql:5
volumes:
- "./data/db:/var/lib/mysql"
ports:
- "3306:3306"
restart: always
#command: --default_authentication_plugin=mysql_native_password
environment:
- MYSQL_ROOT_PASSWORD=secret
- MYSQL_DATABASE=laravel_boilerplate
- MYSQL_USER=root
- MYSQL_PASSWORD=secret
laravel-env:
build: ./dockerfiles
depends_on:
- mysql
volumes:
- ".:/var/www/laravel-boilerplate"
- "./dockerfiles/config/php/php-fpm.conf:/etc/php-fpm.conf"
- "./dockerfiles/config/php/www.conf:/etc/php-fpm.d/www.conf"
- "./dockerfiles/config/php/php.ini:/usr/local/etc/php/php.ini"
- "./dockerfiles/config/php/xdebug.ini:/usr/local/etc/php/conf.d/xdebug.ini"
Apache:
image: httpd:latest
depends_on:
- laravel-env
volumes:
- ".:/var/www/laravel-boilerplate"
- "./dockerfiles/config/nginx/default.conf:/etc/nginx/conf.d/default.conf"
ports:
- "80:80"
restart: always

But there's a thing called volume that leads to a nginx config and i don't know what to do with it.

@r-brown
Copy link
Member

r-brown commented Aug 8, 2020

Yes, this might be correct configuration.
You would need to test it locally, however, by starting docker compose.

@ClaudioRojasA
Copy link
Author

I'm getting errors at
RUN apt-get install -y php-process

RUN apt-get install -y php-imap php-mcrypt php-pecl-imagick php-pspell php-tidy

and

RUN mv composer.phar /usr/bin/composer

@ClaudioRojasA
Copy link
Author

E: Package 'php-mcrypt' has no installation candidate
E: Unable to locate package php-pecl-imagick

mv: cannot stat 'composer.phar': No such file or directory

E: Unable to locate package php-process

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants