How to use docker-abuild in a Dockerfile? - docker

I want to use docker-abuild to build imagemagick in a Dockerfile. I use the following in the Dockerfile:
FROM alpinelinux/docker-abuild as imagickbuilder
COPY imagick/APKBUILD.imagick /home/builder/package/APKBUILD
COPY imagick/APKBUILD.imagick /home/builder/APKBUILD
COPY imagick/disable-avaraging-tests.patch /home/builder/package/disable-avaraging-tests.patch
COPY imagick/webmaster#mycompany.com-5b42f8ed.rsa /home/builder/ssh.rsa
COPY imagick/webmaster#mycompany.com-5b42f8ed.rsa.pub /etc/apk/keys/ssh.rsa.pub
ARG DABUILD_ARCH=aarch64
RUN dabuild -r
# tried abuild -r as well as builder -r
Regardless of what APKBUILD file I have/use, I'm getting the following error while building with docker build -t test .:
#...
#11 [7/7] RUN dabuild -r
#11 sha256:8c6e0fa4c055b4f5bbb7f633a3b4b4009cda31017a26dc48a047fd02466ce60c
#11 0.658 /bin/sh: dabuild: not found
#11 ERROR: executor failed running [/bin/sh -c dabuild -r]: exit code: 127
------
> [7/7] RUN dabuild -r:
------
executor failed running [/bin/sh -c dabuild -r]: exit code: 127
I'm getting the same error with abuild -r and abuilder -r. Any ideas?
JFYI, I'm running this under macOS Monterey 12.2.1 with an M1 Pro MacBook Pro.

Related

Gitlab CI error : Could not build wheels for glpk which use PEP 517 and cannot be installed directly

I have installed in my windows machine locally glpk successfully and runs. However, as a part of Gitlab CI, when I push into Gitlab I am getting the following error:
Building wheel for glpk (PEP 517): started
Building wheel for glpk (PEP 517): finished with status 'error'
ERROR: Command errored out with exit status 1:
command: /usr/local/bin/python /usr/local/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py build_wheel /tmp/tmpr4_114h3
cwd: /tmp/pip-install-dj24wr4l/glpk_fa702cebdf2c4db9a16294c1def2434d
Complete output (16 lines):
running bdist_wheel
running build
running build_ext
building 'glpk' extension
creating build
creating build/temp.linux-x86_64-cpython-38
creating build/temp.linux-x86_64-cpython-38/src
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -DVERSION_NUMBER=\"0.4.6\" -I/usr/local/include/python3.8 -c src/2to3.c -o build/temp.linux-x86_64-cpython-38/src/2to3.o
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -DVERSION_NUMBER=\"0.4.6\" -I/usr/local/include/python3.8 -c src/bar.c -o build/temp.linux-x86_64-cpython-38/src/bar.o
In file included from src/bar.h:24,
from src/bar.c:22:
src/lp.h:24:10: fatal error: glpk.h: No such file or directory
24 | #include <glpk.h>
| ^~~~~~~~
compilation terminated.
error: command '/usr/bin/gcc' failed with exit code 1
----------------------------------------
ERROR: Failed building wheel for glpk
Building wheel for pymeeus (setup.py): started
Building wheel for pymeeus (setup.py): finished with status 'done'
Created wheel for pymeeus: filename=PyMeeus-0.5.11-py3-none-any.whl size=730985 sha256=1cab3ff9087153d2f105c80f95e88cf44ecf87a7489bef56745c268dfe038b8c
Stored in directory: /root/.cache/pip/wheels/a0/8b/b2/810ae5a6f970c8be4725353400d643c90de1c0f023a9884ee7
Successfully built unipath django-crontab pymeeus
Failed to build glpk
ERROR: Could not build wheels for glpk which use PEP 517 and cannot be installed directly
WARNING: You are using pip version 21.2.4; however, version 22.0.4 is available.
You should consider upgrading via the '/usr/local/bin/python -m pip install --upgrade pip' command.
The command '/bin/sh -c pip install -r requirements.txt' returned a non-zero code: 1
Cleaning up file based variables
00:00
ERROR: Job failed: command terminated with exit code 1
I have to note that I do not remember what I did to make glpk run locally and I just added glpk in my requirements.txt file, but this apparently is not correct. What should I do to bypass this error in Gitlab CI? Do I have to add anything in my Dockerfile?
EDIT1: My Dockerfile is the following:
FROM registry.ubitech.eu/public-group/ubitech-public-registry/python:3.6
COPY manage.py gunicorn-cfg.py requirements.txt ./
COPY authentication authentication
COPY core core
COPY routers routers
COPY clustering clustering
COPY data_utilities data_utilities
RUN pip install -r requirements.txt
COPY cron_3.0pl1-137_amd64.deb ./
RUN dpkg -i cron_3.0pl1-137_amd64.deb
RUN mkdir logs
RUN touch logs/phoenix_dashboard.log
EXPOSE 5005
CMD ["gunicorn", "--config", "gunicorn-cfg.py", "core.wsgi"]
EDIT2: When I am trying the solution provided here I am getting the following error:
Step 8/15 : RUN apt install libglpk-dev python3.8-dev libgmp3-dev
---> Running in 0b141af248f9
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
Reading package lists...
Building dependency tree...
Reading state information...
Package libgmp3-dev is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
libgmp-dev
E: Unable to locate package libglpk-dev
E: Unable to locate package python3.8-dev
E: Couldn't find any package by glob 'python3.8-dev'
E: Package 'libgmp3-dev' has no installation candidate
The command '/bin/sh -c apt install libglpk-dev python3.8-dev libgmp3-dev' returned a non-zero code: 100
Cleaning up file based variables
00:00
ERROR: Job failed: command terminated with exit code 1
fatal error: glpk.h: No such file or directory
You are missing the header file(s) for glpk. To make sure this is available, install the library:
RUN apt update && apt install -y libglpk-dev

Syntax error while running shell script via Dockerfile

While executing the run command, I'm getting syntax error as follows:
> [10/10] RUN ./download_files.sh:
#15 0.285 ./download_files.sh: 5: ./download_files.sh: Syntax error: "(" unexpected
------
executor failed running [/bin/sh -c ./download_files.sh]: exit code: 2
The Shell script contents are as follows:
#!/bin/sh
mkdir pretrained_models
cd pretrained_models
declare -a StringArray=("https://zenodo.org/record/4751737/files/BC-DeepLIIF_Training_Set.zip" "https://zenodo.org/record/4751737/files/BC-DeepLIIF_Validation_Set.zip" "https://zenodo.org/record/4751737/files/DeepLIIF_BC_Model.zip" "https://zenodo.org/record/4751737/files/DeepLIIF_Latest_Model.zip" "https://zenodo.org/record/4751737/files/DeepLIIF_Testing_Set.zip" "https://zenodo.org/record/4751737/files/DeepLIIF_Training_Set.zip" "https://zenodo.org/record/4751737/files/DeepLIIF_Validation_Set.zip" "https://zenodo.org/record/4751737/files/Evaluation_Excel_Files.zip")
for val in ${StringArray[#]}; do
exec wget $val
done

How to solve JFrog config read error when building docker image - [Error] open /root/.jfrog/jfrog-cli.conf: read-only file system

I'm building a docker image and getting the error:
=> ERROR [14/36] RUN --mount=type=secret,id=jfrog-cfg,target=/root/.jfrog/jfrog-cli.conf jfrog rt dl --flat artifact 0.7s
------
> [14/36] RUN --mount=type=secret,id=jfrog-cfg,target=/root/.jfrog/jfrog-cli.conf jfrog rt dl --flat artifact/artifact.tar.gz; set -eux; mkdir -p /usr/local/artifact; tar xzf artifact.tar.gz -C /usr/local/; ln -s /usr/local/artifact /usr/local/artifact;:
#22 0.524 [Error] open /root/.jfrog/jfrog-cli.conf: read-only file system
------
failed to solve with frontend dockerfile.v0: failed to solve with frontend gateway.v0: rpc error: code = Unknown desc = failed to build LLB: executor failed running [/bin/bash -eo pipefail -c jfrog rt dl --flat artifact/${ART_TAG}.tar.gz; set -eux; mkdir -p /usr/local/${ART_TAG}; tar xzf ${ART_TAG}.tar.gz -C /usr/local/; ln -s /usr/local/${ART_VERSION} /usr/local/artifact;]: runc did not terminate sucessfully
The command I use to build the docker image is
DOCKER_BUILDKIT=1 docker build -t imagename . --secret id=jfrog-cfg,src=${HOME}/.jfrog/jfrog-cli.conf (jfrog config exists at ${HOME}/.jfrog/jfrog-cli.conf)
JFrog is working and the artifact I'm downloading exists as I can manually download it outside of using docker.
On Linux, docker is run using the root user, so ${HOME} is /root and not /home/your-user-name or whatever your usual home folder is. Try using explicit full pathnames instead of the env var.

RUN command throws "not found"

I have Docker file:
FROM ubuntu:18.04
COPY mylib/src /usr/src
WORKDIR /usr/src
RUN chmod +x configure.sh
RUN ls -l # it display all files, included configure.sh
RUN ./configure.sh # error there
Echo:
RUN ls -l
---> Running in d9ba6b10ed2a
total 604
...
-rwxr-xr-x 1 root root 91 Oct 28 07:30 configure.sh
...
RUN ./configure.sh
---> Running in 2e3e8fdca28e
/bin/sh: 1: ./configure.sh: not found
The command '/bin/sh -c ./configure.sh' returned a non-zero code: 127
File configure.sh exists, but an error occurs: not found
I have this problem only on my Windows PC.
Okaaaay... Problem was in Windows-style line separator. I change CRLF to LF in my configure.sh and it works!

fastlane - error at google cloud build: "OCI runtime create failed: container_linux.go:345"

I'm using fastlane container that stores at google container registry to upload APK to google play store using Google Cloud Build.
APK has been succesfully created.However, when processing last step (fastlane), it face errors:
Step #2: 487ea6dabc0c: Pull complete
Step #2: a7ae4fee33c9: Pull complete
Step #2: Digest: sha256:2e31d5ae64984a598856f1138c6be0577c83c247226c473bb5ad302f86267545
Step #2: Status: Downloaded newer image for gcr.io/myapp789-app/fastlane:latest
Step #2: gcr.io/myapp789-app/fastlane:latest
Step #2: docker: Error response from daemon: OCI runtime create failed: container_linux.go:345: starting container process caused "exec: \"supply\": executable file not found in $PATH": unknown.
Step #2: time="2019-08-29T23:22:55Z" level=error msg="error waiting for container: context canceled"
Finished Step #2
ERROR
ERROR: build step 2 "gcr.io/myapp789-app/fastlane" failed: exit status 127
Note:
1) Docker Source file was taken from https://hub.docker.com/r/fastlanetools/fastlane and then I build my own image.
2) Docker Image Build on Google Cloud VM using Debian GNU/Linux 9 (stretch)
Docker Source File for fastlane:
# Final image #
###############
FROM circleci/ruby:latest
MAINTAINER milch
ENV PATH $PATH:/usr/local/itms/bin
# Java versions to be installed
ENV JAVA_VERSION 8u131
ENV JAVA_DEBIAN_VERSION 8u131-b11-1~bpo8+1
ENV CA_CERTIFICATES_JAVA_VERSION 20161107~bpo8+1
# Needed for fastlane to work
ENV LANG C.UTF-8
ENV LC_ALL C.UTF-8
# Required for iTMSTransporter to find Java
ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64/jre
USER root
# iTMSTransporter needs java installed
# We also have to install make to install xar
# And finally shellcheck
RUN echo 'deb http://archive.debian.org/debian jessie-backports main' > /etc/apt/sources.list.d/jessie-
backports.list \
&& apt-get -o Acquire::Check-Valid-Until=false update \
&& apt-get install --yes \
make \
shellcheck \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
USER circleci
COPY --from=xar_builder /tmp/xar /tmp/xar
RUN cd /tmp/xar \
&& sudo make install \
&& sudo rm -rf /tmp/*
CloudBuild.yaml:
- name: 'gcr.io/$PROJECT_ID/fastlane'
args: ['supply', '--package_name','${_ANDROID_PACKAGE_NAME}', '--track', '${_ANDROID_RELEASE_CHANNEL}', '--json_key_data', '${_GOOGLE_PLAY_UPLOAD_KEY_JSON}', '--apk', '/workspace/${_REPO_NAME}/build/app/outputs/bundle/release/app.aab']
timeout: 1200s
Any Idea to solve this?
I solve this by building docker image using docker source from Google Cloud Official other than fastlane on hub.docker.com (where's it never update since 5 month ago)

Resources