today I came across a weird bug. I am relatively new to Docker, today I was building a Docker environment for a Laravel application. I started with a docker-compose, this file contained the necessary environment variables. Then I deleted the docker-compose file to use only one Dockerfile, the problem occurs when building the app, I should copy the .env (which I know is bad practice, but now I'm just testing), but instead of using the values I have in .env uses the ones I had set in docker-compose. Now without this last file I still have the same problem. So far testie:
- Delete all containers, even offline ones
- Delete all images
- docker builder prune -a
- docker build --no-cache
Some clue ? I've been trying to solve this since this afternoon and it makes me sick >:| .
This is my Dockerfile:
FROM ubuntu:20.04
ENV HOME /root
ENV LC_ALL C.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US.UTF-8
RUN apt-get update -y
RUN apt-get install software-properties-common -y
RUN add-apt-repository ppa:ondrej/php && \
apt-get update -y
RUN apt-get -y install php8.1 php-mysql php-curl php-mcrypt php-cli php-dev php-pear libsasl2-dev
RUN mkdir -p /usr/local/openssl/include/openssl/ && \
ln -s /usr/include/openssl/evp.h /usr/local/openssl/include/openssl/evp.h && \
mkdir -p /usr/local/openssl/lib/ && \
ln -s /usr/lib/x86_64-linux-gnu/libssl.a /usr/local/openssl/lib/libssl.a && \
ln -s /usr/lib/x86_64-linux-gnu/libssl.so /usr/local/openssl/lib/
RUN pecl install mongodb
RUN echo "extension=mongodb.so" > /etc/php/8.1/cli/conf.d/20-mongodb.ini && \
echo "extension=mongodb.so" > /etc/php/8.1/mods-available/mongodb.ini && \
echo "extension=mongodb.so" > /etc/php/8.1/cli/php.ini
RUN mkdir -p /usr/src/app
ENV PORT 8000
EXPOSE 8000
WORKDIR /usr/src/app
RUN apt-get install wget php-zip unzip -y
RUN wget -O composer-setup.php https://getcomposer.org/installer
RUN php composer-setup.php --install-dir=/usr/local/bin --filename=composer
COPY . /usr/src/app
RUN composer install
RUN php artisan fix:passport
RUN php artisan migrate
RUN php artisan passport:install
CMD ["php", "artisan", "serve"]