Closed sinnbeck closed 4 years ago
The next problem I was having is with GNUPG. It seems that it doesnt accept the proxy.
When the proxy is in the command the containers stops completely from build and it doesnt exit anymore.
I am trying to find a proxy I can use so I can test it out myself :) It is hard to fix without having the same set up
Yes I know how hard it is.
I am also trying to find a way.
I will let you know if I find something usefull.
I added proxy to Dockerfile and the run command. You may try installing the branch
composer require sinnbeck/laravel-served:dev-proxy
Be sure to add these to you served.php config file, just after 'name' => env('SERVED_NAME'),
'proxy' => [
'http' => env('SERVED_HTTP_PROXY', ''),
'https' => env('SERVED_HTTPS_PROXY', ''),
],
I found a way to get through GNUPG.
I had to change the keyserver and add my proxy.
Now I am having a problem with redis and PECL.
I could bet it is the proxy again.
gpg --batch --keyserver-options http-proxy=${http_proxy} --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys "$key"; \
Thanks for the feedback. I will add the proxy in there if it is set :)
Can you test the above branch to see if that works ? It sets the proxy for all images and all containers, and skips the whole gpg part
Here is a fully functional Dockerfile.
For Redis to install correctly:
pear config-set http_proxy ${http_proxy}
For GNUPG to retrieve the key correctly:
gpg --batch --keyserver-options http-proxy=${http_proxy} --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys "$key";
Keyserver can be a real pain to get working.
FROM library/php:7.4-fpm
# disable warnings for "dangerous" messages
ENV http_proxy http://my.proxy.de:3128
ENV https_proxy http://my.proxy.de:3128
ENV APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1
# Adding linux packages
RUN pear config-set http_proxy ${http_proxy} \
&& apt-get update \
&& apt-get install -y unzip zip gnupg \
&& rm -rf /var/lib/apt/lists/*
# Installing packages for sql dump
RUN set -ex; \
key='A4A9406876FCBD3C456770C88C718D3B5072E1F5'; \
export GNUPGHOME="$(mktemp -d)"; \
gpg --batch --keyserver-options http-proxy=${http_proxy} --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys "$key"; \
gpg --batch --export "$key" > /etc/apt/trusted.gpg.d/mysql.gpg; \
gpgconf --kill all; \
rm -rf "$GNUPGHOME"; \
apt-key list > /dev/null
RUN echo "deb http://repo.mysql.com/apt/debian/ buster mysql-8.0" > /etc/apt/sources.list.d/mysql.list \
&& apt-get update \
&& apt-get install -y mysql-community-client postgresql-client sqlite3 \
&& rm -rf /var/lib/apt/lists/*
# add development php.ini file
RUN mv "$PHP_INI_DIR/php.ini-development" "$PHP_INI_DIR/php.ini"
# add a local user with the same uid as the local
# prepare empty composer config directory
# ensure user owns its home directory
ARG uid
RUN useradd -G root -u $uid -d /home/served served \
&& mkdir -p /home/served/.composer \
&& chown -R served:served /home/served
# add composer
# set composer to use https
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin/ --filename=composer \
&& runuser -l served -c "composer config --global repos.packagist composer https://packagist.org"
# Adding NPM
RUN curl -sL https://deb.nodesource.com/setup_12.x | bash \
&& apt-get install -y nodejs \
&& curl -L https://www.npmjs.com/install.sh | sh
# Adding php packages
COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/bin/
RUN install-php-extensions pdo_mysql pdo_pgsql redis zip bcmath
# Set work dir
WORKDIR /app
Now it only seems I have to handle some permissions, because I am in Windoww ;o(
Does it work if you move this line
pear config-set http_proxy ${http_proxy}
Down to the installation of the php packages
# Adding php packages
RUN pear config-set http_proxy ${http_proxy}
COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/bin/
RUN install-php-extensions pdo_mysql pdo_pgsql redis zip bcmath
Yes it does work.
It only have to be before you install any PECL package.
Let me know you are doing a new release, so that I can try the whole package out.
Thank you for your support
FROM library/php:7.4-fpm
# disable warnings for "dangerous" messages
ENV http_proxy http://my.proxy.de:3128
ENV https_proxy http://my.proxy.de:3128
ENV APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1
# Adding linux packages
RUN apt-get update \
&& apt-get install -y unzip zip gnupg \
&& rm -rf /var/lib/apt/lists/*
# Installing packages for sql dump
RUN set -ex; \
key='A4A9406876FCBD3C456770C88C718D3B5072E1F5'; \
export GNUPGHOME="$(mktemp -d)"; \
gpg --batch --keyserver-options http-proxy=${http_proxy} --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys "$key"; \
gpg --batch --export "$key" > /etc/apt/trusted.gpg.d/mysql.gpg; \
gpgconf --kill all; \
rm -rf "$GNUPGHOME"; \
apt-key list > /dev/null
RUN echo "deb http://repo.mysql.com/apt/debian/ buster mysql-8.0" > /etc/apt/sources.list.d/mysql.list \
&& apt-get update \
&& apt-get install -y mysql-community-client postgresql-client sqlite3 \
&& rm -rf /var/lib/apt/lists/*
# add development php.ini file
RUN mv "$PHP_INI_DIR/php.ini-development" "$PHP_INI_DIR/php.ini"
# add a local user with the same uid as the local
# prepare empty composer config directory
# ensure user owns its home directory
ARG uid
RUN useradd -G root -u $uid -d /home/served served \
&& mkdir -p /home/served/.composer \
&& chown -R served:served /home/served
# add composer
# set composer to use https
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin/ --filename=composer \
&& runuser -l served -c "composer config --global repos.packagist composer https://packagist.org"
# Adding NPM
RUN curl -sL https://deb.nodesource.com/setup_12.x | bash \
&& apt-get install -y nodejs \
&& curl -L https://www.npmjs.com/install.sh | sh
# Adding php packages
RUN pear config-set http_proxy ${http_proxy}
COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/bin/
RUN install-php-extensions pdo_mysql pdo_pgsql redis zip bcmath
# Set work dir
WORKDIR /app
I will make an update soon. I am just having some issues with gpg --batch --keyserver hpk://80.pool.sks-keyservers.net:80 --recv-keys A4A9406876FCBD3C456770C88C718D3B5072E1F5
not working for me. "No keyserver available".
I think it is because of the hpk protocoll.
Maybe we have to search for a keyserver that works for both.
I have found it here, but I am unable to get it working with port 80 sadly.
http://keys.gnupg.net/pks/lookup?search=0x8C718D3B5072E1F5&fingerprint=on&op=index
gpg --batch --keyserver hkp://keys.gnupg.net:80 --recv-keys 8C718D3B5072E1F5
Does it work if you do
RUN set -ex; \
key='A4A9406876FCBD3C456770C88C718D3B5072E1F5'; \
export GNUPGHOME="$(mktemp -d)"; \
gpg --batch --keyserver-options http-proxy=${http_proxy} --keyserver p80.pool.sks-keyservers.net --recv-keys "$key"; \
gpg --batch --export "$key" > /etc/apt/trusted.gpg.d/mysql.gpg; \
gpgconf --kill all; \
rm -rf "$GNUPGHOME"; \
apt-key list > /dev/null
Nevermind. Got it working with your config now. Removed my docker dns settings, and it suddenly worked. New version has been pushed.
I was about to write that is doesnt work.
Will try the new version.
Thanks
Should I wait for a new release or should I get it from the proxy branch?
Just require it again, and it should give you the latest version :)
composer require sinnbeck/laravel-served:dev-proxy
You have a typo in the Dockerfile.
-keyserver-options
sould be --keyserver-options
.
You had some php extensions enabled in the past, that now arent in the Dockerfile anymore.
pdo_pgsql
and redis
I am now getting a problem with composer, but that could be on my side. I will take a look...
EDIT: You set 2x the same as ENV ENV http_proxy=http://my.proxy:3128 ENV http_proxy=http://my.proxy:3128
One of them should be https.
Both are fixed.
You can add your wanted extensions to this array in served.php. Just trying to keep the base, to a minimum
'modules' => [
'pdo_mysql',
'zip',
'bcmath',
],
Yes I saw that to late.
Now I am getting an Nginx error:
The build process of PHP was flawless.
Great we are making progress! :+1:
It might be because the --env stuff should go before the image name. I have tried moving it. require again to get the newest.
Now I just have one more thing to say...
Thank you for all this.
Yay! :) I assume the urls work as well?
Be aware that you manually need to import the certificate for chrome to work :) https://github.com/sinnbeck/laravel-served#web
Yes, the URLs are working and I see my vanilla Laravel application.
I will take a look at your link.
Thank you again.
New version is out with proxy support: v0.7.0
Thank you very much for the mention and thanks again for this package.
Glad to be of help :) Just happy that it works now
Served has problems running behind a proxy. Post your issues here
@K2ouMais