I am trying to dockerize a PHP / Laravel / VueJS app.
Here is the Dockerfile
FROM php:7.2-fpm
LABEL maintainer="contact@kendozone.com"
LABEL version="1.0.0"
LABEL description="Kendozone is a online tournament webapp coded with PHP / Laravel"
ENV node_version 10.8.0
ENV npm_version 6.4.1
ENV NVM_DIR /.nvm
ENV APP_DIR="/var/www"
ENV APP_PORT="80"
ENV DOCKER_FOLDER="docker/local"
RUN echo "deb http://ftp.de.debian.org/debian stretch main " >> /etc/apt/sources.list \
&& apt-get update -y
RUN apt-get install -y openssl zip unzip git gcc make automake \
libfreetype6-dev \
libjpeg62-turbo-dev \
libmcrypt-dev \
libpng-dev \
libmagickwand-dev vim --no-install-recommends
RUN apt-get purge --auto-remove -y g++ \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
&& docker-php-ext-install pdo pdo_mysql mbstring zip -j$(nproc) iconv -j$(nproc) gd
WORKDIR $APP_DIR
COPY . $APP_DIR
RUN ls $APP_DIR \
&& touch $APP_DIR/database/sqlite.db \
&& mv $DOCKER_FOLDER/.env.local .env \
&& chown -R www-data:www-data $APP_DIR
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \
&& composer install --no-interaction
RUN mkdir -p $NVM_DIR && chown -R www-data:www-data $NVM_DIR \
&& curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash \
&& [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" \
&& nvm install ${node_version}
ENV NODE_PATH $NVM_DIR/v$node_version/lib/node_modules
ENV PATH $NVM_DIR/versions/node/v$node_version/bin:$PATH
RUN npm install --save-exact imagemin-pngquant@5.0.* \
&& npm install \
&& npm run production \
&& php artisan key:generate \
&& php artisan migrate --seed
EXPOSE $APP_PORT
CMD php artisan serve --host=0.0.0.0 --port=$APP_PORT
the last line is supposed to run local server
Then I build it with :
docker build . -t xoco/kendozone:local-1.0.3
Then I run it with:
docker run -p 80:80 xoco/kendozone:local-1.0.3 -d bash
I can see on terminal the output:
[25-Oct-2018 19:56:40] NOTICE: fpm is running, pid 1
[25-Oct-2018 19:56:40] NOTICE: ready to handle connections
EDIT:
➜ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
fee456200b85 xoco/kendozone:local-1.0.3 "docker-php-entrypoi…" 2 hours ago Up 2 hours 9000/tcp, 0.0.0.0:8080->80/tcp youthful_keldysh
Which seems to mean that everything is ok
But I can't reach my app on 127.0.0.1
What am I missing