I faced with range case, when I was try to install some bundle in locally I faced with erro, but when I try install the same bundle in test server everything installed without error. I use docker-compose and install bundle inside in image. docker-copose and other docker file with all dependecies absolutelty the same, all in git.
composer require league/flysystem-bundle
and in locally I faced with that
Using version dev-master for league/flysystem-bundle
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Restricting packages listed in "symfony/symfony" to "5.0.*"
Installation failed, reverting ./composer.json to its original content.
[RuntimeException]
Could not load package ezsystems/ezplatform in http://repo.packagist.org: [
UnexpectedValueException] Could not parse version constraint dev-load-varni
sh-only-when-used as ^2.0#dev: Invalid version string "^2.0#dev"
[UnexpectedValueException]
Could not parse version constraint dev-load-varnish-only-when-used as ^2.0#
dev: Invalid version string "^2.0#dev"
locally composer version Composer version 1.10.11 2020-09-08 16:53:44
and test server
/var/www/symfony # composer require league/flysystem-bundle
Using version dev-master for league/flysystem-bundle
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Restricting packages listed in "symfony/symfony" to "5.0.*"
Prefetching 3 packages 🎶 💨
- Downloading (100%)
Package operations: 3 installs, 0 updates, 0 removals
- Installing league/mime-type-detection (1.4.0): Loading from cache
- Installing league/flysystem (1.x-dev 53f16fd): Loading from cache
- Installing league/flysystem-bundle (dev-master 525845a): Loading from cache
Package easycorp/easy-log-handler is abandoned, you should avoid using it. No replacement was suggested.
Package zendframework/zend-code is abandoned, you should avoid using it. Use laminas/laminas-code instead.
Package zendframework/zend-eventmanager is abandoned, you should avoid using it. Use laminas/laminas-eventmanager instead.
Writing lock file
Generating autoload files
20 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
Symfony operations: 1 recipe (c67222ac592a52b7dec1c2cd56763685)
- WARNING league/flysystem-bundle (>=1.0): From github.com/symfony/recipes-contrib:master
The recipe for this package comes from the "contrib" repository, which is open to community contributions.
Review the recipe at https://github.com/symfony/recipes-contrib/tree/master/league/flysystem-bundle/1.0
Do you want to execute this recipe?
[y] Yes
[n] No
[a] Yes for all packages, only for the current installation session
[p] Yes permanently, never ask again for this project
(defaults to n):
ocramius/package-versions: Generating version class...
ocramius/package-versions: ...done generating version class
Executing script cache:clear [OK]
Executing script assets:install public [OK]
test server composer version Composer version 1.10.10 2020-08-03 11:35:19
my dockerfile
FROM alpine:edge
LABEL maintainer="Vincent Composieux <vincent.composieux#gmail.com>"
RUN apk add --update --no-cache \
coreutils \
yarn \
php7-fpm \
php7-apcu \
php7-ctype \
php7-curl \
php7-dom \
php7-gd \
php7-iconv \
php7-imagick \
php7-json \
php7-intl \
php7-mcrypt \
php7-fileinfo\
php7-mbstring \
php7-opcache \
php7-openssl \
php7-pdo \
php7-pdo_mysql \
php7-mysqli \
php7-pdo_pgsql \
php7-pgsql \
php7-xml \
php7-zlib \
php7-phar \
php7-tokenizer \
php7-session \
php7-simplexml \
php7-xdebug \
php7-zip \
php7-xmlwriter \
make \
curl \
zlib-dev \
libxml2-dev \
rabbitmq-c-dev \
oniguruma-dev \
php7-pecl-amqp \
php7-amqp \
php7-redis
RUN apk add --no-cache --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing/ php7-pecl-mongodb
RUN echo "$(curl -sS https://composer.github.io/installer.sig) -" > composer-setup.php.sig \
&& curl -sS https://getcomposer.org/installer | tee composer-setup.php | sha384sum -c composer-setup.php.sig \
&& php composer-setup.php && rm composer-setup.php* \
&& chmod +x composer.phar && mv composer.phar /usr/bin/composer
COPY symfony.ini /etc/php7/conf.d/
COPY symfony.ini /etc/php7/cli/conf.d/
COPY xdebug.ini /etc/php7/conf.d/
COPY symfony.pool.conf /etc/php7/php-fpm.d/
CMD ["php-fpm7", "-F"]
WORKDIR /var/www/symfony
EXPOSE 9001
Why in the same time I faced with differnt version composer. Composer installed by the same way, by the same Dockerfile. How to fix this problem ?
I don't belive, how it's possible, this problem don't should be appear when using docker structure.. ?
Looks like composer 1.10.11 is broken. You can switch to 1.10.10 like this:
composer-setup.php --version=1.10.10
Confirmed that error from composer 1.10.11. You should down to composer v1.10.10.
composer self-update 1.10.10
You can use self-update to downgrade composer version
Now you can update your composer version to 1.10.12
In this version you don't have this error.
Related
I am using Laradock to deploy a Laravel app.
I am facing a problem with generating a PDF file to attach it in an email in a queued job. The pending jobs are handle by the php-worker container.
The problem is that when you want to attach a PDF to an email, which is queued (therefore, handled by the php-worker container) I get the following error:
"sh: /usr/local/bin/wkhtmltopdf: not found
which means that the wkhtmltopdf is not installed in the php-worker container.
So, taking a look at either the php-fpm or workspace Dockerfile, I can see how to install the wkhtmltopdf like so:
#####################################
# wkhtmltopdf:
#####################################
USER root
ARG INSTALL_WKHTMLTOPDF=false
RUN if [ ${INSTALL_WKHTMLTOPDF} = true ]; then \
apt-get install -yqq \
libxrender1 \
libfontconfig1 \
libx11-dev \
libjpeg62 \
libxtst6 \
fontconfig \
libjpeg62-turbo \
xfonts-base \
xfonts-75dpi \
wget \
&& wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.stretch_amd64.deb \
&& dpkg -i wkhtmltox_0.12.6-1.stretch_amd64.deb \
&& apt -f install \
;fi
If I copy that installation code into the php-worker container, I get the following error
/bin/sh: apt-get: not found
So, searching further, it seems the php-worker container is Alpine based, and probably needs apk add because of Alpine.
I have tried the following:
#####################################
# wkhtmltopdf:
#####################################
USER root
ARG INSTALL_WKHTMLTOPDF=false
RUN if [ ${INSTALL_WKHTMLTOPDF} = true ]; then \
apk add --no-cache \
libxrender1 \
libfontconfig1 \
libx11-dev \
libjpeg62 \
libxtst6 \
fontconfig \
libjpeg62-turbo \
xfonts-base \
xfonts-75dpi \
wget \
wkhtmltopdf \
;fi
But I haven't got luck.
ERROR: unable to select packages: wkhtmltopdf (no such package): required by: world[wkhtmltopdf]
I have been editing the Dockerfile based on this link and this is what I've modified so far:
Dockerfile
#
#--------------------------------------------------------------------------
# Image Setup
#--------------------------------------------------------------------------
#
ARG LARADOCK_PHP_VERSION
FROM php:${LARADOCK_PHP_VERSION}-alpine3.14
LABEL maintainer="Mahmoud Zalt <mahmoud#zalt.me>"
ARG LARADOCK_PHP_VERSION
# If you're in China, or you need to change sources, will be set CHANGE_SOURCE to true in .env.
ARG CHANGE_SOURCE=false
RUN if [ ${CHANGE_SOURCE} = true ]; then \
# Change application source from dl-cdn.alpinelinux.org to aliyun source
sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/' /etc/apk/repositories \
;fi
RUN apk --update add wget \
curl \
git \
build-base \
libmcrypt-dev \
libxml2-dev \
linux-headers \
pcre-dev \
zlib-dev \
autoconf \
cyrus-sasl-dev \
libgsasl-dev \
oniguruma-dev \
libressl \
libressl-dev \
supervisor
# ...................
#####################################
# wkhtmltopdf:
#####################################
USER root
ARG INSTALL_WKHTMLTOPDF=false
RUN set -xe; \
if [ ${INSTALL_WKHTMLTOPDF} = true ]; then \
# Install dependencies for wkhtmltopdf
apk add --update --no-cache --wait 10 \
&& apk --no-cache upgrade \
&& apk add --no-cache \
bash \
libstdc++ \
libx11 \
libxrender \
libxext \
libssl1.1 \
ca-certificates \
fontconfig \
freetype \
ttf-dejavu \
ttf-droid \
ttf-freefont \
ttf-liberation \
xvfb \
#libQt5WebKit \ This throws error. Commented out.
#libQt5WebKitWidgets \ This throws error. Commented out.
#ttf-ubuntu-font-family \ This throws error. Commented out.
&& apk add --update --no-cache --virtual .build-deps \
msttcorefonts-installer \
vim \
\
# Install microsoft fonts
&& update-ms-fonts \
&& fc-cache -f \
\
# Clean up when done
&& rm -rf /tmp/* \
&& apk del .build-deps \
&& wget http://dl-cdn.alpinelinux.org/alpine/v3.14/community/x86_64/wkhtmltopdf-0.12.6-r0.apk \
&& apk add --allow-untrusted wkhtmltopdf-0.12.6-r0.apk \
&& echo 'WKHTMLTOPDF INSTALLED?' \
&& which wkhtmltopdf \
# && ln -s /usr/bin/wkhtmltopdf /usr/local/bin/wkhtmltopdf \
&& cp /usr/bin/wkhtmltoimage /usr/local/bin/ \
&& cp /usr/bin/wkhtmltopdf /usr/local/bin/ \
&& chmod +x /usr/local/bin/wkhtmltoimage \
&& chmod +x /usr/local/bin/wkhtmltopdf \
&& echo 'wkhtmltopdf version: ' \
&& /usr/local/bin/wkhtmltopdf -V \
&& echo 'whoami & permissions' \
&& whoami \
&& ls -lah /usr/bin/ \
&& ls -lah /usr/local/bin/ \
;fi
#
#-----------------------------
# Set PHP memory_limit to infinity
#-------------------------------
#
RUN echo 'set php memory to -1:' \
&& sed -i 's/memory_limit = .*/memory_limit=-1 /' /usr/local/etc/php/php.ini-production \
&& sed -i 's/memory_limit = .*/memory_limit=-1 /' /usr/local/etc/php/php.ini-development \
&& cp /usr/local/etc/php/php.ini-production /usr/local/etc/php/php.ini
# ...
Finally, the wkhtmltopdf seems to be installed:
+ apk add --allow-untrusted wkhtmltopdf-0.12.6-r0.apk
fetch https://dl-cdn.alpinelinux.org/alpine/v3.14/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.14/community/x86_64/APKINDEX.tar.gz
(1/43) Installing icu-libs (67.1-r2)
(2/43) Installing libpcre2-16 (10.36-r0)
(3/43) Installing qt5-qtbase (5.15.3_git20210406-r0)
(4/43) Installing hicolor-icon-theme (0.17-r1)
(5/43) Installing wayland-libs-server (1.19.0-r0)
(6/43) Installing mesa-gbm (21.1.2-r0)
(7/43) Installing wayland-libs-client (1.19.0-r0)
(8/43) Installing qt5-qtdeclarative (5.15.3_git20210531-r0)
(9/43) Installing libxcomposite (0.4.5-r0)
(10/43) Installing wayland-libs-cursor (1.19.0-r0)
(11/43) Installing wayland-libs-egl (1.19.0-r0)
(12/43) Installing libxkbcommon (1.2.1-r0)
(13/43) Installing qt5-qtwayland (5.15.3_git20210510-r0)
(14/43) Installing mesa-egl (21.1.2-r0)
(15/43) Installing libevdev (1.11.0-r1)
(16/43) Installing mtdev (1.1.6-r0)
(17/43) Installing eudev-libs (3.2.10-r0)
(18/43) Installing libinput-libs (1.18.0-r0)
(19/43) Installing xcb-util-wm (0.4.1-r1)
(20/43) Installing xcb-util (0.4.0-r3)
(21/43) Installing xcb-util-image (0.4.0-r1)
(22/43) Installing xcb-util-keysyms (0.4.0-r1)
(23/43) Installing xcb-util-renderutil (0.3.9-r1)
(24/43) Installing libxkbcommon-x11 (1.2.1-r0)
(25/43) Installing qt5-qtbase-x11 (5.15.3_git20210406-r0)
(26/43) Installing qt5-qtsvg (5.15.3_git20200406-r0)
(27/43) Installing qt5-qtlocation (5.15.3_git20201109-r0)
(28/43) Installing qt5-qtsensors (5.15.3_git20201028-r1)
(29/43) Installing qt5-qtwebchannel (5.15.3_git20201028-r0)
(30/43) Installing libxv (1.0.11-r2)
(31/43) Installing alsa-lib (1.2.5-r2)
(32/43) Installing cdparanoia-libs (10.2-r9)
(33/43) Installing gstreamer (1.18.4-r0)
(34/43) Installing libogg (1.3.5-r0)
(35/43) Installing opus (1.3.1-r1)
(36/43) Installing orc (0.4.32-r0)
(37/43) Installing libtheora (1.1.1-r16)
(38/43) Installing libvorbis (1.3.7-r0)
(39/43) Installing gst-plugins-base (1.18.4-r0)
(40/43) Installing hyphen (2.8.8-r1)
(41/43) Installing libxslt (1.1.35-r0)
(42/43) Installing qt5-qtwebkit (5.212.0_alpha4-r14)
(43/43) Installing wkhtmltopdf (0.12.6-r0)
Executing busybox-1.33.1-r7.trigger
OK: 877 MiB in 254 packages
WKHTMLTOPDF INSTALLED?
+ echo 'WKHTMLTOPDF INSTALLED?'
+ which wkhtmltopdf
/usr/bin/wkhtmltopdf
+ cp /usr/bin/wkhtmltoimage /usr/local/bin/
+ cp /usr/bin/wkhtmltopdf /usr/local/bin/
+ chmod +x /usr/local/bin/wkhtmltoimage
+ chmod +x /usr/local/bin/wkhtmltopdf
+ echo 'wkhtmltopdf version: '
+ /usr/local/bin/wkhtmltopdf -V
wkhtmltopdf version:
wkhtmltopdf 0.12.6
+ echo 'whoami & permissions'
+ whoami
whoami & permissions
root
+ ls -lah /usr/bin/
-rwxr-xr-x 1 root root 979 Jun 1 2021 supervisorctl
-rwxr-xr-x 1 root root 975 Jun 1 2021 supervisord
-rwxr-xr-x 1 root root 114.1K Jun 11 2020 wkhtmltoimage
-rwxr-xr-x 1 root root 162.1K Jun 11 2020 wkhtmltopdf
+ ls -lah /usr/local/bin/
-rwxr-xr-x 1 root root 114.1K May 25 16:37 wkhtmltoimage
-rwxr-xr-x 1 root root 162.1K May 25 16:37 wkhtmltopdf
Step 82/86 : COPY supervisord.conf /etc/supervisord.conf
---> de059f102569
Step 83/86 : ENTRYPOINT ["/usr/bin/supervisord", "-n", "-c", "/etc/supervisord.conf"]
BUT when I try to execute the container to verify that the wkhtmltopdf is indeed installed,
❯ docker container exec php-worker /usr/local/bin/wkhtmltopdf -V ─╯
OCI runtime exec failed: exec failed: container_linux.go:380: starting container process caused: exec: "/usr/local/bin/wkhtmltopdf": stat /usr/local/bin/wkhtmltopdf: no such file or directory: unknown
turns out that it's not been installed! And therefore, I get the exact same error in my application:
"sh: /usr/local/bin/wkhtmltopdf: not found
And, on the other hand, for example, the supervisor does work:
❯ docker container exec php-worker supervisorctl ─╯
laravel-scheduler:laravel-scheduler_00 RUNNING pid 52576, uptime 18:27:24
laravel-worker:laravel-worker_00 RUNNING pid 52577, uptime 18:27:24
supervisor>
Does anybody know how to install wkhtmltopdf in Alpine Dockerfile for real?
The PHP images you're using are built on Alpine 3.15; it looks like wkhtmltopdf isn't package in that version of Alpine:
$ docker run --rm alpine:3.15 sh -c 'apk add --update wkhtmltopdf'
fetch https://dl-cdn.alpinelinux.org/alpine/v3.15/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.15/community/x86_64/APKINDEX.tar.gz
ERROR: unable to select packages:
wkhtmltopdf (no such package):
required by: world[wkhtmltopdf]
It looks like wkhtmltopdf is only available in 3.14 and earlier (I
checked 3.14 and 3.13):
$ docker run --rm alpine:3.14 sh -c 'apk add --update wkhtmltopdf'
fetch https://dl-cdn.alpinelinux.org/alpine/v3.14/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.14/community/x86_64/APKINDEX.tar.gz
(1/103) Installing dbus-libs (1.12.20-r2)
(2/103) Installing libgcc (10.3.1_git20210424-r2)
[...]
(103/103) Installing wkhtmltopdf (0.12.6-r0)
Executing busybox-1.33.1-r7.trigger
OK: 196 MiB in 117 packages
This is noted in the release notes for 3.15, which say:
QtWebKit was removed due to lack of upstream support
qt5-qtwebkit, kdewebkit, wkhtmltopdf, and py3-pdfkit have been removed due to known vulnerabilities and lack of upstream support for qtwebkit. Other programs have been adjusted to use qt5-qtwebengine where appropriate. The most direct replacement for wkhtmltopdf is weasyprint, which is available in the Alpine Linux community repository. puppeteer and pandoc are also options, depending on your needs. See #12888 for more information.
You could dry building your own PHP base image on top of an older Alpine release using the upstream Dockerfile, or you could try starting with the vanilla alpine:3.14 image and installing php using apk.
Or just stick with an Ubuntu-based image, which still packages
wkhtmltopdf.
I am relatively new to docker. I have an application which I want to containerize.
Below is is my docker file:
FROM ubuntu:16.04
## ENV Variables
ENV PYTHON_VERSION="3.6.5"
# Update and Install packages
RUN apt-get update -y \
&& apt-get install -y \
curl \
wget \
tar
# Install Python 3.6.5
RUN wget https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tar.xz \
&& tar -xvf Python-${PYTHON_VERSION}.tar.xz \
&& cd Python-${PYTHON_VERSION} \
&& ./configure \
&& make altinstall \
&& cd / \
&& rm -rf Python-${PYTHON_VERSION}
# Install Google Cloud SDK
# Downloading gcloud package
RUN curl https://dl.google.com/dl/cloudsdk/release/google-cloud-sdk.tar.gz > /tmp/google-cloud-sdk.tar.gz
# Installing the package
RUN mkdir -p /usr/local/gcloud \
&& tar -C /usr/local/gcloud -xvf /tmp/google-cloud-sdk.tar.gz \
&& /usr/local/gcloud/google-cloud-sdk/install.sh
# Adding the package path to local
ENV PATH $PATH:/usr/local/gcloud/google-cloud-sdk/bin
I am trying to install python3.6.5 version but I am receiving the following error.
020-01-09 17:26:13 (107 KB/s) - 'Python-3.6.5.tar.xz' saved [17049912/17049912]
tar (child): xz: Cannot exec: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now
The command '/bin/sh -c wget https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tar.xz && tar -xvf Python-${PYTHON_VERSION}.tar.xz && cd Python-${PYTHON_VERSION} && ./configure && make altinstall && cd / && rm -rf Python-${PYTHON_VERSION}' returned a non-zero code: 2
Decompressing an .xz file requires the xz binary which under ubuntu is provided by the package xz-utils So You have to instal xz-utils on your image prior to decompressing an .xz file.
You can add this to your previous apt-get install run:
# Update and Install packages
RUN apt-get update -y \
&& apt-get install -y \
curl \
wget \
tar \
xz-utils
This should fix the following call to tar in the next RUN expression
Instead of trying to install Python, just start with a base image that has Python preinstalled, e.g. python:3.6-buster. This image is based on Debian Buster, which was released in 2019. Since Ubuntu is based on Debian, everything will be pretty similar, and since it's from 2019 (as opposed to Ubuntu 16.04, which is from 2016) you'll get more up-to-date software.
See https://pythonspeed.com/articles/base-image-python-docker-images/ for longer discussion.
When I use curl --head to test my website, it returns the server information.
I followed this tutorial to hide the nginx server header.
But when I run the command yum install nginx-module-security-headers
, it returns yum: not found.
I also tried apk add nginx-module-security-headers, and it shows that the package is missing.
I have used nginx:1.17.6-alpine as my base docker image. Does anyone know how to hide the server from header under this Alpine?
I think I have an easier solution here: https://gist.github.com/hermanbanken/96f0ff298c162a522ddbba44cad31081. Big thanks to hermanbanken on Github for sharing this gist.
The idea is to create a multi stage build with the nginx alpine image to be a base for compiling the module. This turns into the following Dockerfile:
ARG VERSION=alpine
FROM nginx:${VERSION} as builder
ENV MORE_HEADERS_VERSION=0.33
ENV MORE_HEADERS_GITREPO=openresty/headers-more-nginx-module
# Download sources
RUN wget "http://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz" -O nginx.tar.gz && \
wget "https://github.com/${MORE_HEADERS_GITREPO}/archive/v${MORE_HEADERS_VERSION}.tar.gz" -O extra_module.tar.gz
# For latest build deps, see https://github.com/nginxinc/docker-nginx/blob/master/mainline/alpine/Dockerfile
RUN apk add --no-cache --virtual .build-deps \
gcc \
libc-dev \
make \
openssl-dev \
pcre-dev \
zlib-dev \
linux-headers \
libxslt-dev \
gd-dev \
geoip-dev \
perl-dev \
libedit-dev \
mercurial \
bash \
alpine-sdk \
findutils
SHELL ["/bin/ash", "-eo", "pipefail", "-c"]
RUN rm -rf /usr/src/nginx /usr/src/extra_module && mkdir -p /usr/src/nginx /usr/src/extra_module && \
tar -zxC /usr/src/nginx -f nginx.tar.gz && \
tar -xzC /usr/src/extra_module -f extra_module.tar.gz
WORKDIR /usr/src/nginx/nginx-${NGINX_VERSION}
# Reuse same cli arguments as the nginx:alpine image used to build
RUN CONFARGS=$(nginx -V 2>&1 | sed -n -e 's/^.*arguments: //p') && \
sh -c "./configure --with-compat $CONFARGS --add-dynamic-module=/usr/src/extra_module/*" && make modules
# Production container starts here
FROM nginx:${VERSION}
COPY --from=builder /usr/src/nginx/nginx-${NGINX_VERSION}/objs/*_module.so /etc/nginx/modules/
.... skipped inserting config files and stuff ...
# Validate the config
RUN nginx -t
Alpine repo probably doesn't have the ngx_security_headers module but, the mentioned tutorial also provides an option of using Headers More module. You should be able to install this module in your alpine distro using the command:
apk add nginx-mod-http-headers-more
Hope it helps.
Source
I found the alternate solution. The reason that it shows binary not compatible is because I have one nginx pre-installed under the target route, and it is not compatible with the header-more module I am using. That means I cannot simply install the third party library from Alpine package.
So I prepare a clean Alpine OS, and follow the GitHub repository to build Nginx from the source with additional feature. The path of build result is the prefix path you specified.
i'm trying to make a dockerfile that contains Nginx stable latest compiled with vts module .... there is a big problem i'm having that i can't find some automotive link when i put in the docker file it will download and install the latest stable nginx i can only specify a version like 1.14.2 is there a way i can modify my dockerfile to make it download the latest always and not only one version ?
this is my dockerfile
FROM debian:stretch-slim
RUN apt-get update && \
apt-get install -y git wget libreadline-dev libncurses5-dev libpcre3- dev libssl-dev perl make build-essential zlib1g-dev && \
cd /tmp/ && \
wget http://nginx.org/download/nginx-1.14.2.tar.gz && \
git clone git://github.com/vozlt/nginx-module-vts.git && \
tar zxvf nginx-1.14.2.tar.gz && \
rm -f nginx-1.14.2.tar.gz && \
cd nginx-1.14.2 && \
./configure --prefix=/tmp/nginx-1.14.2 --sbin-path=/usr/sbin/nginx -- modules-path=/usr/lib/nginx/modules --conf-path=/etc/nginx/nginx.conf \
--error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid \
--lock-path=/var/run/nginx.lock --http-client-body-temp- path=/var/cache/nginx/client_temp --http-proxy-temp- path=/var/cache/nginx/proxy_temp \
--http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi- temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp- path=/var/cache/nginx/scgi_temp \
--user=nginx --group=nginx --with-compat --with-file-aio --with- threads --with-http_addition_module --with-http_auth_request_module \
--with-http_dav_module --with-http_flv_module --with- http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module \
--with-http_random_index_module --with-http_realip_module --with- http_secure_link_module --with-http_slice_module --with-http_ssl_module \
--with-http_stub_status_module --with-http_sub_module --with- http_v2_module --with-mail --with-mail_ssl_module --with-stream \
--with-stream_realip_module --with-stream_ssl_module --with- stream_ssl_preread_module \
--with-cc-opt='-g -O2 -fdebug-prefix-map=/data/builder/debuild/nginx- 1.14.2/debian/debuild-base/nginx-1.14.2=. -specs=/usr/share/dpkg/no-pie- compile.specs -fstack-protector-strong -Wformat -Werror=format-security - Wp,-D_FORTIFY_SOURCE=2 -fPIC' \
--with-ld-opt='-specs=/usr/share/dpkg/no-pie-link.specs -Wl,-z,relro - Wl,-z,now -Wl,--as-needed -pie' \
--add-module=/tmp/nginx-module-vts && \
make && make install && \
cp -f objs/nginx /usr/sbin/nginx && \
apt-get clean && rm -rf /var/lib/apt/lists/*
CMD ["nginx", "-g", "daemon off;"]
If you are looking for an easy way to keep using the stable version during compiling nginx from source as there is no one direct url for it afaik, then you can pass a build argument to your Dockerfile like this:
...
ARG NGINX_STABLE_VERSION
RUN wget http://nginx.org/download/nginx-${NGINX_STABLE_VERSION}.tar.gz
...
And run the build command like below to keep downloading nginx version based on the passed argument:
docker build --build-arg NGINX_STABLE_VERSION=1.14.2 .
However if you are look for how to keep using the official docker image for nginx with your custom modules - assuming all the custom modules you are using support dynamic modules feature like vts module - then you can do it by using multi-stage builds and make use of nginx dynamic modules
feature.
According to nginx-module-vts changelog there is a support for compiling the module as a dynamic module so you can do a multi-stage build that compile nginx with the module you want then copy the generated file to nginx image with the same version to make it work.
Nginx stable images can be found in here tagged with stable word.
All you need to do now is to modify the Dockerfile and make it use the dynamic modules way then add another stage for using the stable image with the new module that was generated from the first stage and you can add an argument during the build for example:
...
ARG NGINX_STABLE_VERSION
RUN wget http://nginx.org/download/nginx-${NGINX_STABLE_VERSION}.tar.gz
...
And run the build like this:
docker build --build-arg NGINX_STABLE_VERSION=1.14.2 .
Update:
Nginx does not provide a one link that you can use to get the stable version every time so you might go with parsing the html of the download page like the following to keep getting the latest download link for the stable version:
We rely on the HTML page which is not the most robust solution on the long term.
echo "http://nginx.org$(curl -s http://nginx.org/en/download.html | grep -oP 'Stable version.*?\K(/download/.*?tar.gz)')"
Output:
http://nginx.org/download/nginx-1.14.2.tar.gz
In your Dockerfile it can be like this:
Make sure that you have curl installed
RUN curl "http://nginx.org$(curl -s http://nginx.org/en/download.html | grep -oP 'Stable version.*?\K(/download/.*?tar.gz)')" --output nginx.tar.gz
we are trying to host tensorflow object-detection model on GCP.
we have maintain below directory structure before running "gcloud app deploy".
For you convenient I am attaching the configuration files with the question.
Wer are getting deployment error which is mentioned below. Please suggest a solution.
+root
+object_detection/
+slim/
+env
+app.yaml
+Dockerfile
+requirement.txt
+index.html
+test.py
Dockerfile
FROM gcr.io/google-appengine/python
LABEL python_version=python2.7
RUN virtualenv --no-download /env -p python2.7
# Set virtualenv environment variables. This is equivalent to running
# source /env/bin/activate
ENV VIRTUAL_ENV /env
ENV PATH /env/bin:$PATH
# Various Python and C/build deps
RUN apt-get update && apt-get install -y \
wget \
build-essential \
cmake \
git \
unzip \
pkg-config \
python-dev \
python-opencv \
libopencv-dev \
libav-tools \
libjpeg-dev \
libpng-dev \
libtiff-dev \
libjasper-dev \
libgtk2.0-dev \
python-numpy \
python-pycurl \
libatlas-base-dev \
gfortran \
webp \
python-opencv \
qt5-default \
libvtk6-dev \
zlib1g-dev \
protobuf-compiler \
python-pil python-lxml \
python-tk
# Install Open CV - Warning, this takes absolutely forever
ADD requirements.txt /app/
RUN pip install -r requirements.txt
ADD . /app/
RUN protoc /app/object_detection/protos/*.proto --python_out=/app/.
RUN export PYTHONPATH=$PYTHONPATH:`pwd`:`pwd`/app/slim
CMD exec gunicorn -b :$PORT UploadTest:app
requirement.txt
Flask==0.12.2
gunicorn==19.7.1
numpy==1.13.1
requests==0.11.1
bs4==0.0.1
nltk==3.2.1
pymysql==0.7.2
xlsxwriter==0.8.5
Pillow==4.2.1
pytesseract==0.1
opencv-python>=3.0
matplotlib==2.0.2
tensorflow==1.3.0
lxml==4.0.0
app.yaml
runtime: custom
env: flex
entrypoint: gunicorn -b :$PORT UploadTest:app
threadsafe: true
runtime_config:
python_version: 2
After all this i am seeting up the google cloud environment with gcloud init
And then start command gcloud app deploy
I am getting below error while deploying the solution.
Error:
Step 10/12 : RUN protoc /app/object_detection/protos/*.proto --python_out=/app/.
---> Running in 9b3ec9c43c2d
/app/object_detection/protos/anchor_generator.proto: File does not reside within any path specified using --proto_path (or -I). You must specify a --proto_path which encompasses this file. Note that the proto_path must be an exact prefix of the .proto file names -- protoc is too dumb to figure out when two paths (e.g. absolute and relative) are equivalent (it's harder than you think).
The command '/bin/sh -c protoc /app/object_detection/protos/*.proto --python_out=/app/.' returned a non-zero code: 1
ERROR
ERROR: build step "gcr.io/cloud-builders/docker#sha256:a4a83be9b2fb61452e864ecf1bcfca99d1845499ef9500ae2905cea0ea593769" failed: exit status 1
----------------------------------------------------------------------------------------------------------------------------------------------
ERROR: (gcloud.app.deploy) Cloud build failed. Check logs at https://console.cloud.google.com/gcr/builds/4dba3217-b7d6-4341-b28e-09a9dad45c18?
There is a directory "object_detection/protos" present and all necessary files are present there. Still getting deployment error. Please suggest where to change in dockerfile to deploy it successfully.
My assumption: GCP is not able to figure out the path of the protc file. May be I have to alter something in Docketfile. But not able to figure out the solution. Please answer.
NB: This setup is running well in local machine. But not working in GCP