Docker Build failing when dockerizing rails application - ruby-on-rails

I'm dockerizing a rails application, when trying to build the docker image from the docker file which I've written, rails installation is failing.
This is the Dockerfile. I've made sure the ruby, rails, and bundler versions on my laptop and in the Dockerfile are the same.
My docker version is Docker version 20.10.5, build 55c4c88
FROM ubuntu:16.04
ENV RUBY_MAJOR="2.6" \
RUBY_VERSION="2.6.3" \
RUBYGEMS_VERSION="3.0.8" \
BUNDLER_VERSION="1.17.3" \
RAILS_VERSION="5.2.1" \
RAILS_ENV="production" \
GEM_HOME="/usr/local/bundle"
ENV BUNDLE_PATH="$GEM_HOME" \
BUNDLE_BIN="$GEM_HOME/bin" \
BUNDLE_SILENCE_ROOT_WARNING=1 \
BUNDLE_APP_CONFIG="$GEM_HOME"
ENV PATH="$BUNDLE_BIN:$GEM_HOME/bin:$GEM_HOME/gems/bin:$PATH"
USER root
RUN apt-get update && \
apt-get -y install sudo
RUN echo "%sudo ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers && \
addgroup --gid 1024 stars && \
useradd -G stars,sudo -d /home/user --shell /bin/bash -m user
RUN mkdir -p /usr/local/etc \
&& echo 'install: --no-document' >> /usr/local/etc/gemrc \
&& echo 'update: --no-document' >> /usr/local/etc/gemrc
USER user
RUN sudo apt-get -y install --no-install-recommends vim make gcc zlib1g-dev autoconf build-essential libssl-dev libsqlite3-dev \
curl htop unzip mc openssh-server openssl bison libgdbm-dev ruby git libmysqlclient-dev tzdata mysql-client
RUN sudo rm -rf /var/lib/apt/lists/* \
&& sudo curl -fSL -o ruby.tar.gz "http://cache.ruby-lang.org/pub/ruby/$RUBY_MAJOR/ruby-$RUBY_VERSION.tar.gz" \
&& sudo mkdir -p /usr/src/ruby \
&& sudo tar -xzf ruby.tar.gz -C /usr/src/ruby --strip-components=1 \
&& sudo rm ruby.tar.gz
USER root
RUN cd /usr/src/ruby \
&& { sudo echo '#define ENABLE_PATH_CHECK 0'; echo; cat file.c; } > file.c.new && mv file.c.new file.c \
&& autoconf \
&& ./configure --disable-install-doc
USER user
RUN cd /usr/src/ruby \
&& sudo make -j"$(nproc)" \
&& sudo make install \
&& sudo gem update --system $RUBYGEMS_VERSION \
&& sudo rm -r /usr/src/ruby
RUN sudo gem install bundler --version "$BUNDLER_VERSION"
RUN sudo mkdir -p "$GEM_HOME" "$BUNDLE_BIN" \
&& sudo chmod 777 "$GEM_HOME" "$BUNDLE_BIN" \
&& sudo gem install rails --version "$RAILS_VERSION"
RUN mkdir -p ~/.ssh && \
chmod 0700 ~/.ssh && \
ssh-keyscan github.com > ~/.ssh/known_hosts
ARG ssh_pub_key
ARG ssh_prv_key
RUN echo "$ssh_pub_key" > ~/.ssh/id_rsa.pub && \
echo "$ssh_prv_key" > ~/.ssh/id_rsa && \
chmod 600 ~/.ssh/id_rsa.pub && \
chmod 600 ~/.ssh/id_rsa
USER root
RUN curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
RUN apt-get install -y nodejs
USER user
WORKDIR /data
RUN sudo mkdir /data/checklist
WORKDIR /data/checklist
ADD Gemfile Gemfile.lock ./
RUN sudo chown -R user /data/checklist
RUN bundle install
ADD . .
RUN sudo chown -R user /data/checklist
EXPOSE 3001
ENV RAILS_SERVE_STATIC_FILES true
ENV RAILS_LOG_TO_STDOUT true
RUN chmod +x ./config/docker/prepare-db.sh && sh ./config/docker/prepare-db.sh
CMD ["sh", "./config/docker/startup.sh"]
Error is
#13 90.14 ERROR: Error installing rails:
#13 90.14 ERROR: Failed to build gem native extension.
#13 90.14
#13 90.14 current directory: /usr/local/lib/ruby/gems/2.6.0/gems/mimemagic-0.3.10/ext/mimemagic
#13 90.14 /usr/local/bin/ruby -rrubygems /usr/local/lib/ruby/gems/2.6.0/gems/rake-12.3.2/exe/rake RUBYARCHDIR\=/usr/local/lib/ruby/gems/2.6.0/extensions/x86_64-linux/2.6.0-static/mimemagic-0.3.10 RUBYLIBDIR\=/usr/local/lib/ruby/gems/2.6.0/extensions/x86_64-linux/2.6.0-static/mimemagic-0.3.10
#13 90.14 rake aborted!
#13 90.14 Could not find MIME type database in the following locations: ["/usr/local/share/mime/packages/freedesktop.org.xml", "/opt/homebrew/share/mime/packages/freedesktop.org.xml", "/opt/local/share/mime/packages/freedesktop.org.xml", "/usr/share/mime/packages/freedesktop.org.xml"]
#13 90.14
#13 90.14 Ensure you have either installed the shared-mime-info package for your distribution, or
#13 90.14 obtain a version of freedesktop.org.xml and set FREEDESKTOP_MIME_TYPES_PATH to the location
#13 90.14 of that file.
#13 90.14
#13 90.14 This gem might be installed as a dependency of some bigger package, such as rails, activestorage,
#13 90.14 axlsx or cucumber. While most of these packages use the functionality of this gem, some gems have
#13 90.14 included this gem by accident. Set USE_FREEDESKTOP_PLACEHOLDER=true if you are certain that you
#13 90.14 do not need this gem, and wish to skip the inclusion of freedesktop.org.xml.
#13 90.14
#13 90.14 The FREEDESKTOP_PLACEHOLDER option is meant as a transitional feature, and will be deprecated in
#13 90.14 the next release.
#13 90.14
#13 90.14 Tasks: TOP => default
#13 90.14 (See full trace by running task with --trace)
#13 90.14
#13 90.14 rake failed, exit code 1
#13 90.14
#13 90.14 Gem files will remain installed in /usr/local/lib/ruby/gems/2.6.0/gems/mimemagic-0.3.10 for inspection.
#13 90.14 Results logged to /usr/local/lib/ruby/gems/2.6.0/extensions/x86_64-linux/2.6.0-static/mimemagic-0.3.10/gem_make.out
------
executor failed running [/bin/sh -c sudo mkdir -p "$GEM_HOME" "$BUNDLE_BIN" && sudo chmod 777 "$GEM_HOME" "$BUNDLE_BIN" && sudo gem install rails --version "$RAILS_VERSION"]: exit code: 1
I'm stuck here not able to proceed further. Please help me out.

Related

How to add symbolic link or alias to dockerfile?

I have the following dockerfile:
FROM python:3.10-alpine
LABEL Name=my_app
WORKDIR /app
RUN addgroup --gid 1000 -S my_app && \
adduser --uid 1000 -D -S my_app -G my_app -s /sbin/nologin
COPY --chown=1000:1000 pyproject.toml README.rst src ./
RUN apk add --no-cache --virtual=.build-deps build-base libffi-dev curl openssl-dev && \
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && \
source $HOME/.cargo/env && \
pip install --upgrade pip && pip install --no-cache-dir ./ && \
apk del .build-deps && \
rustup self uninstall -y
RUN chown -R 1000:1000 /app
USER my_app
It is working and I am capable to run inside of this container the following command: my_app run --checks all path_name. Because some reason I need to change my_app key phrase to my_app_2 key phrase. So I would able to run the following command: my_app_2 run --checks all path_name. I cannot change underling files outside of dockerfile because of some server configuration. What changes in dockerfile could I make?
I tried to add:
RUN ln -s /usr/local/bin/my_app /usr/local/bin/my_app_2
But getting an error during build prosses::
=> ERROR [7/7] RUN ln -s /usr/local/bin/my_app /usr/local/bin/my_app 0.3s
------
> [7/7] RUN ln -s /usr/local/bin/my_app /usr/local/bin/my_app_2:
#0 0.256 ln: /usr/local/bin/my_app_2: Permission denied
------
failed to solve: executor failed running [/bin/sh -c ln -s /usr/local/bin/my_app /usr/local/bin/my_app_2]: exit code: 1
Also I tried to swap my_app_2 and my_app:
RUN ln -s /usr/local/bin/my_app_2 /usr/local/bin/my_app
But getting another error during build prosses:
=> ERROR [7/7] RUN ln -s /usr/local/bin/my_app_2 /usr/local/bin/my_app 0.5s
------
> [7/7] RUN ln -s /usr/local/bin/my_app_2 /usr/local/bin/my_app:
#0 0.516 ln: /usr/local/bin/my_app: File exists
------
failed to solve: executor failed running [/bin/sh -c ln -s /usr/local/bin/my_app_2 /usr/local/bin/my_app]: exit code: 1
Third attempt. I added:
RUN echo "alias my_app_2='my_app'" >> ~/.bashrc
Built was successful but when I run
my_app_2 run --checks all my_path_here
I am getting:
sh: my_app_2: not found
Run the command while you are still root. Unprivileged users can't modify arbitrary files on the filesystem:
FROM python:3.10-alpine
LABEL Name=my_app
WORKDIR /app
RUN addgroup --gid 1000 -S my_app && \
adduser --uid 1000 -D -S my_app -G my_app -s /sbin/nologin
COPY --chown=1000:1000 pyproject.toml README.rst src ./
RUN apk add --no-cache --virtual=.build-deps build-base libffi-dev curl openssl-dev && \
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && \
source $HOME/.cargo/env && \
pip install --upgrade pip && pip install --no-cache-dir ./ && \
apk del .build-deps && \
rustup self uninstall -y
# run other steps as root here
RUN ln -s /usr/local/bin/my_app /usr/local/bin/my_app_2
RUN chown -R 1000:1000 /app
USER my_app
# you are no longer root here

save plotly images from Rstudio in docker, get error ! System command 'orca' failed

I have RStudio in docker, and am trying to save a plotly image using orca. I installed orca following Docker and Plotly.
I build and start successfully, and to check if I can save an image I run:
library(plotly)
library(processx)
fig <- plot_ly(z = ~volcano) %>% add_surface()
orca(fig,"t.png")
Whereupon I receive the following error:
Error in `processx::run("orca", "-h")`:
! System command 'orca' failed
---
Exit status: 127
Stderr: <empty>
---
Type .Last.error to see the more details.
Warning message:
'orca' is deprecated.
Use 'kaleido' instead.
See help("Deprecated")
> .Last.error
<system_command_status_error/rlib_error_3_0/rlib_error/error>
Error in `processx::run("orca", "-h")`:
! System command 'orca' failed
---
Exit status: 127
Stderr: <empty>
---
Backtrace:
1. plotly::orca(fig, "t.png")
2. plotly:::orca_available()
3. plotly:::correct_orca()
4. processx::run("orca", "-h")
5. processx:::throw(new_process_error(res, call = sys.call(), echo = echo, …
>
Is there another way to install orca, or save a plotly image in RStudio running in docker?
My full dockerfile:
FROM rocker/verse
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends build-essential libpq-dev python3.9 python3-pip python3-setuptools python3-dev
RUN pip3 install --upgrade pip
ADD . ./home/rstudio
ADD requirements.txt .
ADD install_packages.r .
# Miniconda and dependencies
RUN cd /tmp/ && \
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh && \
bash Miniconda3-latest-Linux-x86_64.sh -b -p $HOME/miniconda3 && \
/root/miniconda3/condabin/conda install -y python=3.7
ENV PATH=$PATH:/root/miniconda3/bin
#RUN npm install phantomjs-prebuilt --phantomjs_cdnurl=http://cnpmjs.org/downloads
# installing python libraries
RUN pip3 install -r requirements.txt
# installing r libraries
RUN Rscript install_packages.r
RUN if ! [[ "16.04 18.04 20.04 21.04 21.10" == *"$(lsb_release -rs)"* ]]; \
then \
echo "Ubuntu $(lsb_release -rs) is not currently supported."; \
exit; \
fi
RUN sudo su
RUN apt-get update && apt-get install -y gnupg2
RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
RUN curl https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/prod.list > /etc/apt/sources.list.d/mssql-release.list
RUN exit
RUN sudo apt-get update
RUN sudo ACCEPT_EULA=Y apt-get install -y msodbcsql17
RUN chmod -R 777 /home/rstudio
# Download orca AppImage, extract it, and make it executable under xvfb
RUN apt-get install --yes xvfb libgconf-2-4
RUN wget https://github.com/plotly/orca/releases/download/v1.1.1/orca-1.1.1-x86_64.AppImage -P /home
RUN chmod 777 /home/orca-1.1.1-x86_64.AppImage
# To avoid the need for FUSE, extract the AppImage into a directory (name squashfs-root by default)
RUN cd /home && /home/orca-1.1.1-x86_64.AppImage --appimage-extract
RUN printf '#!/bin/bash \nxvfb-run --auto-servernum --server-args "-screen 0 640x480x24" /home/squashfs-root/app/orca "$#"' > /usr/bin/orca
RUN chmod 777 /usr/bin/orca
RUN chmod -R 777 /home/squashfs-root/

Command works on heroku command line but not in the pushed docker image

I have the following Dockerfile:
FROM ubuntu:latest
RUN apt-get -qq update && apt-get -qq -y install wget\
&& wget https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein \
&& chmod a+x lein \
&& cp lein /usr/bin
RUN "lein -v"
to download lein from the url, and put it in /usr/bin. But still the
RUN lein -v
command doesn't work.
I get the error:
remote: Step 18/22 : RUN lein -v
remote: ---> Running in e5f404275fe2
remote: /bin/sh: 1: lein -v: not found
remote: The command '/bin/sh -c lein -v' returned a non-zero code: 127
remote:
remote: Verifying deploy...
remote:
remote: ! Push rejected to appname
On Heroku one-off dyno itself, the command works.
$ /bin/sh -c "lein -v"
the problem is that docker RUN expects the command unquoted, as is, or as an array of command and its args:
one of RUN lein -v or RUN ["lein", "-v"] should do the trick.
the other problem, that your image doesn't have java installed, so the command would fail anyway. So you need to install it somehow. Your final Dockerfile could look like this:
FROM ubuntu:latest
RUN apt-get -qq update && apt-get -qq -y install wget\
&& wget https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein \
&& chmod a+x lein \
&& cp lein /usr/bin
RUN DEBIAN_FRONTEND=noninteractive \
apt-get -y install default-jre-headless && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
RUN ["lein", "-v"]
-- EDIT --
In fact, adding the java dependency and changing to RUN ["lein", "-v"] doesn't work either. These are the first fifteen steps of the Dockerfile:
ARG CLOJURE_TOOLS_VERSION=1.10.1.507
RUN apt-get -qq update && apt-get -qq -y install curl wget bzip2 openjdk-8-jdk-headless\
&& curl -sSL https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -o /tmp/miniconda.sh \
# && curl -sSL https://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-x86_64.sh -o /tmp/miniconda.sh \
&& bash /tmp/miniconda.sh -bfp /usr/local \
&& rm -rf /tmp/miniconda.sh \
&& conda install -y python=3 \
&& conda update conda \
&& curl -o install-clojure https://download.clojure.org/install/linux-install-${CLOJURE_TOOLS_VERSION}.sh \
&& chmod +x install-clojure \
&& ./install-clojure && rm install-clojure \
# no need to install lein
&& wget https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein > /usr/bin/lein \
&& chmod 777 /usr/bin/lein \
&& apt-get -qq -y autoremove \
&& apt-get autoclean \
&& rm -rf /var/lib/apt/lists/* /var/log/dpkg.log \
&& conda clean --all --yes
ENV PATH /usr/bin:$PATH
ENV NODE_VERSION=12.18.1
RUN curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash
ENV NVM_DIR=/root/.nvm
RUN . "$NVM_DIR/nvm.sh" && nvm install ${NODE_VERSION}
RUN . "$NVM_DIR/nvm.sh" && nvm use v${NODE_VERSION}
RUN . "$NVM_DIR/nvm.sh" && nvm alias default v${NODE_VERSION}
ENV PATH="/root/.nvm/versions/node/v${NODE_VERSION}/bin/:${PATH}"
RUN node --version
RUN npm --version
# ENV PATH /opt/conda/bin:$PATH
# RUN conda create -n pyclj python=3.7 && conda install -n pyclj numpy mxnet \
# && conda install -c conda-forge opencv
# ## To install pip packages into the pyclj environment do
# RUN conda run -n pyclj python3 -mpip install numpy opencv-python
FROM openjdk:8-alpine
RUN ["lein", "-v"]
and it gives the error
remote: Step 15/19 : RUN ["lein", "-v"]
remote: ---> Running in b817213d45b5
remote: OCI runtime create failed: container_linux.go:349: starting container process caused "exec: \"lein\": executable file not found in $PATH": unknown
remote:
remote: Verifying deploy...
remote:
remote: ! Push rejected to

docker - tomcat8 on centos 7

I am trying to deploy a war to tomcat 8 on centos 7. I am getting the following error while deploying a war into the tomcat 8.
Caused by: org.postgresql.util.PSQLException: ERROR: could not load library "/usr/pgsql-9.3/lib/plperl.so": /usr/pgsql-9.3/lib/plperl.so: undefined symbol: errcontext
Where: PL/pgSQL function db.c_scr(text,text,text,text,text,text,text,text,date,date,character,character,boolean,boolean,text,character,text,text,character,text,character varying,text,text,boolean,text,text,boolean,character,text,text,text) line 1285 at FOR over EXECUTE statement
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2412) ~[postgresql-42.0.0.jre6.jar:42.0.0.jre6]
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2125) ~[postgresql-42.0.0.jre6.jar:42.0.0.jre6]
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:297) ~[postgresql-42.0.0.jre6.jar:42.0.0.jre6]
at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:428) ~[postgresql-42.0.0.jre6.jar:42.0.0.jre6]
at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:354) ~[postgresql-42.0.0.jre6.jar:42.0.0.jre6]
at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:301) ~[postgresql-42.0.0.jre6.jar:42.0.0.jre6]
at org.postgresql.jdbc.PgStatement.executeCachedSql(PgStatement.java:287) ~[postgresql-42.0.0.jre6.jar:42.0.0.jre6]
at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:264) ~[postgresql-42.0.0.jre6.jar:42.0.0.jre6]
at org.postgresql.jdbc.PgStatement.executeQuery(PgStatement.java:231) ~[postgresql-42.0.0.jre6.jar:42.0.0.jre6]
at org.apache.tomcat.dbcp.dbcp2.DelegatingStatement.executeQuery(DelegatingStatement.java:254) ~[tomcat-dbcp.jar:8.5.47]
at org.apache.tomcat.dbcp.dbcp2.DelegatingStatement.executeQuery(DelegatingStatement.java:254) ~[tomcat-dbcp.jar:8.5.47]
at org.springframework.jdbc.core.JdbcTemplate$1QueryStatementCallback.doInStatement(JdbcTemplate.java:452) ~[spring-jdbc-4.0.6.RELEASE.jar:4.0.6.RELEASE]
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:402) ~[spring-jdbc-4.0.6.RELEASE.jar:4.0.6.RELEASE]
FROM centos:7
RUN ./initialize_env.sh
initialize_env.sh is as follows.
yum -y update && yum clean all
yum -y install unzip wget httpd httpd-devel gcc* make && yum clean all
# Install mod_jk
curl -SL https://archive.apache.org/dist/tomcat/tomcat-connectors/jk/tomcat-connectors-1.2.40-src.tar.gz -o tomcat-connectors-1.2.40-src.tar.gz \
&& mkdir -p src/tomcat-connectors \
&& tar xzf tomcat-connectors-1.2.40-src.tar.gz -C src/tomcat-connectors --strip-components=1 \
&& cd src/tomcat-connectors/native/ \
&& ./configure --with-apxs=/usr/bin/apxs \
&& make \
&& cp apache-2.0/mod_jk.so /usr/lib64/httpd/modules/ \
&& ./libtool --finish /usr/lib64/httpd/modules/ \
&& cd / \
&& rm -rf src/ \
&& rm -f tomcat-connectors-1.2.40-src.tar.gz
echo "Downloading tomcat"
cd /apps/
wget http://apache.mirrors.pair.com/tomcat/tomcat-8/v8.5.47/bin/apache-tomcat-8.5.47.zip
unzip apache-tomcat-8.5.47.zip
mv apache-tomcat-8.5.47 tomcat
chmod -R 755 tomcat
chmod -R +x tomcat/bin
yum -y install postgresql-plperl
yum -y install java
wget https://download.postgresql.org/pub/repos/yum/9.3/redhat/rhel-7-x86_64/pgdg-centos93-9.3-3.noarch.rpm
rpm -ivh pgdg-centos93-9.3-3.noarch.rpm
yum -y install postgresql93 postgresql93-server postgresql93-libs postgresql93-contrib postgresql93-devel postgresql93-plperl
After this installation, i see this output.
sh-4.2# ls -l /usr/pgsql-9.3/lib/plperl.so
-rwxr-xr-x 1 root root 87304 Nov 7 2018 /usr/pgsql-9.3/lib/plperl.so
I need to run Apache Web server with Tomcat. I have a postgres jdbc driver (version 9) under $tomcat_home/lib directory. I even tried a higher version of jdbc driver, but it is still throwing the same error.
does anybody know why?
Is there anything else that I need to do?

Docker doesn't find file

I'm working on a project that uses a Docker image for a specific feature, other than that I don't need docker at all so I don't understand much about it. The issue is that Docker doesn't finds a file that is actually in the folder and the build process breaks.
When trying to create the image using docker build -t project/render-worker . the error is this:
Step 18/23 : RUN bin/composer-install && php composer-setup.php --install-dir=/bin && php -r 'unlink("composer-setup.php");' && php /bin/composer.phar global require hirak/prestissimo
---> Running in 695db3bf2f02
/bin/sh: 1: bin/composer-install: not found
The command '/bin/sh -c bin/composer-install && php composer-setup.php --install-dir=/bin && php -r 'unlink("composer-setup.php");' && php /bin/composer.phar global require hirak/prestissimo' returned a non-zero code: 127
As mentioned the file composer-install does exist and this is what's in it:
#!/bin/sh
EXPECTED_SIGNATURE="$(wget -q -O - https://composer.github.io/installer.sig)"
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
ACTUAL_SIGNATURE="$(php -r "echo hash_file('SHA384', 'composer-setup.php');")"
if [ "$EXPECTED_SIGNATURE" != "$ACTUAL_SIGNATURE" ]
then
echo 'ERROR: Invalid installer signature'
rm composer-setup.php
fi
Basically this is to get composer as you can see.
This is the Docker file:
FROM php:7.2-apache
RUN echo 'deb http://ftp.debian.org/debian stretch-backports main' > /etc/apt/sources.list.d/backports.list
RUN apt-get update
RUN apt-get install -y --no-install-recommends \
libpq-dev \
libxml2-dev \
ffmpeg \
imagemagick \
wget \
git \
zlib1g-dev \
libpng-dev \
unzip \
mencoder \
parallel \
ruby-dev
RUN apt-get -t stretch-backports install -y --no-install-recommends \
libav-tools \
&& rm -rf /var/lib/apt/lists/*
RUN docker-php-ext-install \
pcntl \
pdo_pgsql \
pgsql \
soap \
gd \
zip
RUN gem install compass
RUN a2enmod rewrite
ENV APACHE_RUN_USER root
ENV APACHE_RUN_GROUP root
EXPOSE 80
WORKDIR /app
COPY . /app
# Configuring apache to run the symfony app
COPY config/docker/apache.conf /etc/apache2/sites-enabled/000-default.conf
RUN echo "export DATABASE_URL" >> /etc/apache2/envvars \
&& echo ". /etc/environment" >> /etc/apache2/envvars
RUN wget -cqO- https://nodejs.org/dist/v10.15.3/node-v10.15.3-linux-x64.tar.xz | tar -xJ
RUN cp -a node-v10.15.3-linux-x64/bin /usr \
&& cp -a node-v10.15.3-linux-x64/include /usr \
&& cp -a node-v10.15.3-linux-x64/lib /usr \
&& cp -a node-v10.15.3-linux-x64/share /usr/ \
&& rm -rf node-v10.15.3-linux-x64 node-v10.15.3-linux-x64.tar.xz
RUN bin/composer-install \
&& php composer-setup.php --install-dir=/bin \
&& php -r "unlink('composer-setup.php');" \
# Install prestissimo for dramatically faster `composer install`
&& php /bin/composer.phar global require hirak/prestissimo
RUN APP_ENV=prod APP_SECRET= DATABASE_URL= AWS_KEY= AWS_SECRET= AWS_REGION= MEDIA_S3_BUCKET= \
GIPHY_API_KEY= FACEBOOK_APP_ID= FACEBOOK_APP_SECRET= \
GOOGLE_API_KEY= GOOGLE_CLIENT_ID= GOOGLE_CLIENT_SECRET= STRIPE_SECRET_KEY= STRIPE_ENDPOINT_SECRET= \
THEYSAIDSO_API_KEY= REV_CLIENT_API_KEY= REV_USER_API_KEY= REV_API_ENDPOINT= RENDER_QUEUE_URL= \
CLOUDWATCH_LOG_GROUP_NAME= \
php /bin/composer.phar install --no-interaction --no-dev --prefer-dist --optimize-autoloader --no-scripts \
&& php /bin/composer.phar clear-cache
RUN npm install \
&& node_modules/bower/bin/bower install --allow-root \
&& node_modules/grunt/bin/grunt
# Don't allow it to keep logs around; they're emitted on STDOUT and sent to AWS
# CloudWatch from there, so we don't need them on disk filling up the space
RUN mkdir -p var/cache/prod && chmod -R 777 var/cache/prod
RUN mkdir -p var/log && ln -s /dev/null var/log/prod.log \
&& ln -s /dev/null var/log/prod.deprecations.log && chmod -R 777 var/log
CMD ["/usr/bin/env", "bash", "./bin/start_render_worker"]
Like I said, unfortunately I don't have the slightest idea of how docker works and what's going on, just that I need it. I'm running docker in Win10 Pro and to make matters even worst it is actually working for another dev running Win10. We tried a few things but we can't make it work. I tried cloning the repo in other locations with no success at all. Everything before this particular step runs correctly.
[EDIT]
As suggested by the users I ran RUN ls bin/ before the composer install line and this is the result:
Step 18/24 : RUN ls bin/
---> Running in 6cb72090a069
append_captions
capture
composer-install
concat_project_video
console
encode_frames
encode_frames_to_gif
format_video_for_concatenation
generate_meme_bar
image_to_video
install.sh
phpcs
phpunit
process_render_queue
publish_docker_image
run_animation_worker
run_render_worker
run_render_worker_osx
start_render_worker
update
Removing intermediate container 6cb72090a069
As you can see composer-install is there so this is quite baffling.
Also I checked and set the line ending sequence to LF and the result is the same error.
[SECOND EDIT]
I added COPY bin/composer-install /bin
Then RUN ls bin/
And the results are the same. The ls command finds the file but the error persists. Also adding a slash before bin doesn't change anything :(

Resources