undefined: grpc.SupportPackageIsVersion7 grpc.ServiceRegistrar - docker

Inside docker, it seems that I cannot compile my gRPC micro-service due to this error:
Step 4/9 : RUN make build
---> Running in ceb6e4d0e19b
protoc --version
libprotoc 3.12.4
protoc --proto_path=pkg/proto/notify/ --go_out=pkg/proto/notify/ --go-grpc_out=pkg/proto/notify/ --go_opt=paths=source_relative --go-grpc_opt=paths=source_relative notify.proto
plugin versions reported in *.pb.go files:
./pkg/proto/notify/notify.pb.go:// protoc-gen-go v1.25.0-devel
./pkg/proto/notify/notify.pb.go:// protoc v3.12.4
go build -o notify-service *.go
go: downloading github.com/lib/pq v1.7.0
go: downloading google.golang.org/grpc v1.27.0
go: downloading github.com/jinzhu/gorm v1.9.14
go: downloading github.com/aws/aws-sdk-go v1.33.7
go: downloading github.com/go-kit/kit v0.10.0
go: downloading google.golang.org/protobuf v1.25.0
go: downloading github.com/go-co-op/gocron v0.2.1
go: downloading github.com/sirupsen/logrus v1.6.0
go: downloading github.com/golang/protobuf v1.4.2
go: downloading github.com/matcornic/hermes/v2 v2.1.0
go: downloading github.com/jhillyerd/enmime v0.8.1
go: downloading golang.org/x/sys v0.0.0-20200523222454-059865788121
go: downloading github.com/jaytaylor/html2text v0.0.0-20190408195923-01ec452cbe43
go: downloading github.com/vanng822/go-premailer v0.0.0-20191214114701-be27abe028fe
go: downloading github.com/imdario/mergo v0.3.9
go: downloading github.com/russross/blackfriday/v2 v2.0.1
go: downloading github.com/jinzhu/inflection v1.0.0
go: downloading github.com/Masterminds/sprig v2.16.0+incompatible
go: downloading golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2
go: downloading github.com/PuerkitoBio/goquery v1.5.1
go: downloading github.com/pkg/errors v0.9.1
go: downloading golang.org/x/text v0.3.2
go: downloading github.com/vanng822/css v0.0.0-20190504095207-a21e860bcd04
go: downloading github.com/shurcooL/sanitized_anchor_name v1.0.0
go: downloading github.com/aokoli/goutils v1.0.1
go: downloading google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013
go: downloading gopkg.in/gormigrate.v1 v1.6.0
go: downloading github.com/gorilla/css v1.0.0
go: downloading github.com/ssor/bom v0.0.0-20170718123548-6386211fdfcf
go: downloading github.com/andybalholm/cascadia v1.1.0
go: downloading github.com/gogs/chardet v0.0.0-20150115103509-2404f7772561
go: downloading golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37
go: downloading github.com/olekukonko/tablewriter v0.0.1
go: downloading github.com/cention-sany/utf7 v0.0.0-20170124080048-26cad61bd60a
go: downloading github.com/huandu/xstrings v1.2.0
go: downloading github.com/Masterminds/semver v1.4.2
go: downloading github.com/google/uuid v1.1.1
go: downloading github.com/mattn/go-runewidth v0.0.4
go: downloading github.com/go-logfmt/logfmt v0.5.0
go: downloading github.com/jmespath/go-jmespath v0.3.0
# gitlab.com/kuecr/fero/backend/notify/pkg/proto/notify
pkg/proto/notify/notify_grpc.pb.go:14:11: undefined: grpc.SupportPackageIsVersion7
pkg/proto/notify/notify_grpc.pb.go:71:30: undefined: grpc.ServiceRegistrar
make: *** [Makefile:14: build] Error 2
ERROR: Service 'notify' failed to build: The command '/bin/sh -c make build' returned a non-zero code: 2
make: *** [Makefile:64: build/notify] Error 1
However, outside of Docker the thing is run and compile with success.
This is my base Docker image:
RG go_version
FROM golang:${go_version}-buster
ARG pb_version
RUN apt-get update && apt-get install -y build-essential curl git wget unzip && rm -rf /var/lib/apt/lists/*
RUN wget https://github.com/protocolbuffers/protobuf/releases/download/v${pb_version}/protobuf-cpp-${pb_version}.zip && \
unzip protobuf-cpp-${pb_version}.zip && \
cd protobuf-${pb_version} && \
./configure && \
make && \
make check && \
make install && \
ldconfig && \
cd ../ && \
rm -rf protobuf-*
RUN go get github.com/githubnemo/CompileDaemon && \
go get github.com/golang/protobuf/protoc-gen-go && \
go get github.com/grpc/grpc-go/cmd/protoc-gen-go-grpc && \
go install github.com/golang/protobuf/protoc-gen-go && \
go install github.com/grpc/grpc-go/cmd/protoc-gen-go-grpc
This is the Docker image where the compilation is done:
FROM registry.gitlab.com/kuecr/devops/go-protobuf-base:1.14 as base
WORKDIR /app
COPY . .
RUN make build
FROM base as testing
ENTRYPOINT ["make", "test"]
FROM base as production
RUN make build
ENTRYPOINT CompileDaemon -log-prefix=false -build="go build -o notify-service" -command="./notify-service"
My docker and docker-compose and protoc versions:
✖ docker --version && docker-compose --version
Docker version 19.03.12-ce, build 48a66213fe
docker-compose version 1.26.2, build unknown
➜ protoc --version
libprotoc 3.12.4
This is what happens when I ran make build on my machine:
➜ make build
protoc --version
libprotoc 3.12.4
protoc --proto_path=pkg/proto/notify/ --go_out=pkg/proto/notify/ --go-grpc_out=pkg/proto/notify/ --go_opt=paths=source_relative --go-grpc_opt=paths=source_relative notify.proto
plugin versions reported in *.pb.go files:
./pkg/proto/notify/notify.pb.go:// protoc-gen-go v1.25.0
./pkg/proto/notify/notify.pb.go:// protoc v3.12.4
go build -o notify-service *.go
I'm using Golang 1.15 while the Docker image use 1.14.

Already they have provided this solution in their documentation here. I had the same issue and here is my solution:
go get -u github.com/golang/protobuf/{proto,protoc-gen-go}
go get -u google.golang.org/grpc
protoc --go_out=plugins=grpc:. *.proto
Here is the explanation if you are not using Go modules:

The gist of this error is that the version of binary used to generate the code isn't compatible with the current version of code. A quick and easy solution would be to try updating the protoc-gen-go compiler and the gRPC library to the latest version.
go get -u github.com/golang/protobuf/protoc-gen-go
then regen the proto
heres a link to a reddit thread that discusses the issue

grpc.SupportPackageIsVersion is used to track the version of the protobuf generated code and is different from the grpc release version.
In short, Your generated GRPC code structure is newer than your google.golang.org/grpc package. So you must update your go grpc package to the new one.
SupportPackageIsVersion7 support after 1.32.0 versions. and they support old versions with go version >= 1.12
to update it you should
first, remove the current one, to find where it stored, you can use the echo $PATH command to find out where this file is. then remove it.
second, install the new one, for installing it you can run this command.
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc
Note If you have any problem to get it, use this command instead,
go get -u github.com/golang/protobuf/protoc-gen-go
after the update, you must edit your go.mod file.
change this line:
google.golang.org/grpc v1.21.1
to
google.golang.org/grpc v1.32.0// or newer
Note: You can find last releases from this URL
You can find versions supports of the package at the end of rpc_util.go in constants.
something like this:
const (
SupportPackageIsVersion3 = true
SupportPackageIsVersion4 = true
SupportPackageIsVersion5 = true
SupportPackageIsVersion6 = true
SupportPackageIsVersion7 = true
)

I solved this problem by specifying grpc-go version to v1.33.0-dev, but this version is not included in ver v1.31.1.

Even with go get -u my version for some reason didn't get updated to the last one. I had to update google.golang.org/grpc v1.27.0 to google.golang.org/grpc v1.34.0 (latest version attow) in my go.mod manually. Then it worked.

Complementary to #Jay Lane answer, I want to share the Dockerfile configuration I put together:
ARG go_version
FROM golang:${go_version}-buster
ARG pb_version
ARG grpc_version
ARG gen_version
ARG compile_daemon_version
ARG dlv_version
RUN apt-get update && apt-get install -y build-essential curl git wget unzip && rm -rf /var/lib/apt/lists/*
RUN wget https://github.com/protocolbuffers/protobuf/releases/download/v${pb_version}/protobuf-cpp-${pb_version}.zip && \
unzip protobuf-cpp-${pb_version}.zip && \
cd protobuf-${pb_version} && \
./configure && \
make && \
make check && \
make install && \
ldconfig && \
cd ../ && \
rm -rf protobuf-*
WORKDIR /tmp
RUN GO111MODULE=on go get google.golang.org/protobuf/cmd/protoc-gen-go#v${gen_version} && \
GO111MODULE=on go get google.golang.org/grpc#v${grpc_version} && \
GO111MODULE=on go get github.com/githubnemo/CompileDaemon#v${compile_daemon_version} && \
GO111MODULE=on go get github.com/go-delve/delve/cmd/dlv#v${dlv_version}
RUN git clone https://github.com/grpc/grpc-go.git && \
cd grpc-go/cmd/protoc-gen-go-grpc && \
git checkout v${grpc_version} && go install . && \
cd /tmp && rm -rf grpc-go
WORKDIR /go
and I also updated google.golang.org/grpc to v1.31.1.
EDIT:
This is the Makefile I use to help me build this image, is included for the sake of completeness:
GO_VERSION=1.14
PROTOBUF_VERSION=3.12.4
GEN_VERSION=1.25.0
GRPC_VERSION=1.31.1
COMPILE_DAEMON_VERSION=1.2.1
DLV_VERSION=1.5.0
push: build
docker push registry.gitlab.com/kuecr/devops/go-protobuf-base:$(GO_VERSION)
build:
docker build \
--build-arg pb_version=$(PROTOBUF_VERSION) \
--build-arg go_version=$(GO_VERSION) \
--build-arg gen_version=$(GEN_VERSION) \
--build-arg grpc_version=$(GRPC_VERSION) \
--build-arg compile_daemon_version=$(COMPILE_DAEMON_VERSION) \
--build-arg dlv_version=$(DLV_VERSION) \
-t registry.gitlab.com/kuecr/devops/go-protobuf-base:$(GO_VERSION) .
history:
docker image history registry.gitlab.com/kuecr/devops/go-protobuf-base:$(GO_VERSION)
sh:
docker run --rm --interactive --tty --entrypoint /bin/sh registry.gitlab.com/kuecr/devops/go-protobuf-base:$(GO_VERSION)

Related

Docker build fio with librbd

I need to build a docker image of fio with librbd so that I can set the ioengine=rbd. I am building for arch aarch64. When I run fio with ioengine=rbd I get an error saying unable to load librbd. Any help here really appreciated.
Here is my Dockerfile:
# syntax=docker/dockerfile:1
From alpine
RUN apk add --update-cache fio librbd --repository=http://dl-cdn.alpinelinux.org/alpine/edge/community
I build and push my docker image:
$ sudo docker build . -t manjo8/fio
Sending build context to Docker daemon 2.048kB
Step 1/2 : From alpine
---> bb3de5531c18
Step 2/2 : RUN apk add --update-cache fio librbd --repository=http://dl-cdn.alpinelinux.org/alpine/edge/community
---> Running in 68e44788feb0
fetch http://dl-cdn.alpinelinux.org/alpine/edge/community/aarch64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.14/main/aarch64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.14/community/aarch64/APKINDEX.tar.gz
(1/19) Installing libaio (0.3.112-r1)
(2/19) Installing numactl (2.0.14-r0)
(3/19) Installing fio (3.28-r1)
(4/19) Installing libblkid (2.37.2-r0)
(5/19) Installing libbz2 (1.0.8-r1)
(6/19) Installing libgcc (10.3.1_git20210424-r2)
(7/19) Installing xz-libs (5.2.5-r0)
(8/19) Installing boost1.76-iostreams (1.76.0-r0)
(9/19) Installing boost1.76-thread (1.76.0-r0)
(10/19) Installing libstdc++ (10.3.1_git20210424-r2)
(11/19) Installing fmt (7.1.3-r1)
(12/19) Installing eudev-libs (3.2.10-r0)
(13/19) Installing librados (16.2.6-r1)
(14/19) Installing argon2-libs (20190702-r1)
(15/19) Installing device-mapper-libs (2.02.187-r1)
(16/19) Installing json-c (0.15-r1)
(17/19) Installing libuuid (2.37.2-r0)
(18/19) Installing cryptsetup-libs (2.3.6-r0)
(19/19) Installing librbd (16.2.6-r6)
Executing busybox-1.33.1-r3.trigger
OK: 26 MiB in 33 packages
Removing intermediate container 68e44788feb0
---> 1534fb8d9308
Successfully built 1534fb8d9308
Successfully tagged manjo8/fio:latest
When I run the docker image I get an error saying its unable to load librdb.
fio-5c6dc65894-bh7dt
fio: file:ioengines.c:127, func=dlopen, error=Error loading shared library rbd: No such file or directory
fio: engine rbd not loadable
fio: failed to load engine
If you look at the build log for fio, it says that it is building fio without support for Rados Block Device engine:
Rados Block Device engine no
So, the only thing to do is to build it from source. Using the build script from alpine, plus some googling for how to build fio with rbd support, I came up with this:
From alpine
ENV fio_version=3.28
RUN set -vuo pipefail \
&& apk add --no-cache libaio-dev librados librbd \
&& apk add --no-cache --virtual .build-deps linux-headers zlib-dev coreutils gcc make musl-dev ceph-dev \
&& cd /tmp \
&& wget https://github.com/axboe/fio/archive/fio-$fio_version.tar.gz \
&& tar -xzf fio-$fio_version.tar.gz \
&& rm /tmp/fio-$fio_version.tar.gz \
&& cd /tmp/fio-fio-$fio_version \
&& ./configure \
--prefix=/usr \
--disable-native \
&& make -j \
&& make install \
&& rm -rf /tmp/fio-fio-$fio_version \
&& apk del --no-network .build-deps
I'm only able to test it in a limited way, given that I don't have a ceph cluster, but I'm able to get past the error you were having.
I also spent some effort optimizing the build so it wouldn't waste space by including build-time dependencies into the image. (This is the --virtual .build-deps and apk del .build-deps stages you see above.)

Why can't I get ocaml/opam:ubuntu-16.04_ocaml-4.03.0 docker Image?

I was trying to run:
docker build -f hol-light/Dockerfile_check_proofs --ulimit stack=1000000000 --tag check_proofs hol-light/
but I get the error:
Sending build context to Docker daemon 48.9MB
Step 1/16 : FROM ocaml/opam:ubuntu-16.04_ocaml-4.03.0
pull access denied for ocaml/opam, repository does not exist or may require 'docker login': denied: requested access to the resource is denied
Why?
The docker file is: https://github.com/brain-research/hol-light/blob/master/Dockerfile_check_proofs
FROM ocaml/opam:ubuntu-16.04_ocaml-4.03.0
WORKDIR /home/opam/
SHELL ["/bin/bash", "-c"]
ENV PATH="/home/opam/.opam/4.03.0/bin:${PATH}"
### Install num
RUN opam install num
### Install campl5
RUN git clone --depth 1 -b rel617 https://github.com/camlp5/camlp5
RUN cd camlp5 &&\
./configure &&\
make world.opt &&\
make install &&\
# meta/Makefile in camlp5 skips these files which we need, so copy them
# manually.
cp {main/pcaml,main/quotation,etc/pa_reloc,meta/q_MLast}.{cmi,cmx,o} `camlp5 -where`
### Install grpc
RUN sudo apt-get update &&\
sudo apt-get install -y build-essential autoconf libtool pkg-config clang libc++-dev
RUN git clone -b 'v1.17.1' --recurse-submodule --depth 1 https://github.com/grpc/grpc
RUN sudo make -C grpc install-headers_c install-static_c install-pkg-config_c\
install-headers_cxx install-static_cxx install-pkg-config_cxx\
install-plugins
RUN sudo make -C grpc/third_party/protobuf install
### Install farmhash
RUN git clone --depth 1 https://github.com/google/farmhash &&\
cd farmhash &&\
./configure CXXFLAGS="-DNAMESPACE_FOR_HASH_FUNCTIONS=farmhash"
RUN sudo make -C farmhash install
### Build binaries
COPY --chown=opam:0 . src/
RUN make -C src check_proofs
CMD ["./src/check_proofs"]
crossposted:
https://forums.docker.com/t/why-cant-i-get-ocaml-opam-ubuntu-16-04-ocaml-4-03-0-docker-image/84351
https://hub.docker.com/r/ocaml/opam/ hasn't been updated for 2 years and says:
At some point in the future, the tags in this repository will be deleted
This deletion is currently in progress (in fact, it has been deleting for more than a week now).
The ocaml/opam (opam 1) images generally aren't useful now because they don't work with the current opam-repository.
There are two alternatives you can use:
ocaml/opam2 contains opam 2 images. e.g. ocaml/opam2:ubuntu-16.04-ocaml-4.03
ocurrent/opam is also opam 2, but contains much smaller images (with only one version of the compiler per image). e.g. ocurrent/opam:ubuntu-16.04-ocaml-4.03
However, this repository is only temporary. It will replace ocaml/opam once Hub finishes deleting that...

Tensorflow serving GPU using REST API and SSL self certificate

I am trying to install TensorFlow-gpu with REST API in Centos 7 Docker container. But I am unable to find an exact procedure for this. Do I need to install following dependencies?
I have installed cuda 9.0
cdDNN 7.4
NCCL 2.x
I haven't started yet to build tensorflow serving using GPU. I m in the middle of research stage ~ in this process in every article showing related to Ubuntu installation and m trying to install.in centos 7 .. so I don't have any docker file ..
Hope this may help you and me to get solution .
Here is what I use to build a tensorflow-serving-runtime docker image.
FROM nvidia/cuda:9.0-cudnn7-runtime-centos7
ARG TF_VERSION=1.9.0
RUN yum install -y \
yum-plugin-ovl \
libgomp \
ca-certificates \
zip \
unzip \
curl \
&& \
yum clean all
WORKDIR /usr/
RUN curl -sSL -o /usr/nccl_2.2.13-1-cuda9.0_x86_64.tgz http://some-of-my-net-disk/tensorflow-serving/lib/nccl_2.2.13-1-cuda9.0_x86_64.tgz && \ # Change your way to get nccl library here
tar -xvf nccl_2.2.13-1-cuda9.0_x86_64.tgz &&\
rm -f nccl_2.2.13-1-cuda9.0_x86_64.tgz
ENV LD_LIBRARY_PATH /usr/nccl_2.2.13-1+cuda9.0_x86_64/lib/:${LD_LIBRARY_PATH}
# Change your way to get tensorflow_model_server here
WORKDIR /serving
RUN curl -sSL -o /usr/local/bin/tensorflow_model_server http://some-of-my-net-disk/tensorflow-serving/bin/tf-serving-${TF_VERSION}/tensorflow_model_server_gpu-centos &&\
chmod u+x /usr/local/bin/tensorflow_model_server
For me, this worked fine. Hope it helps.

How to install Go in alpine linux

I am trying to install Go inside an Alpine Docker image. For that I downloaded tar file from here inside my alpine docker image, untar it using following command:
tar -C /usr/local -xzf go1.10.3.linux-amd64.tar.gz
exported PATH to have go binary as:
export PATH=$PATH:/usr/local/go/bin
However, when I say go version then it says that sh: go: not found. I am quite new to alpine. Does anyone know, what I am missing here?
Steps to reproduce-
$ docker run -it alpine sh
$ wget https://dl.google.com/go/go1.10.3.linux-amd64.tar.gz
$ tar -C /usr/local -xzf go1.10.3.linux-amd64.tar.gz
$ export PATH=$PATH:/usr/local/go/bin
$ go version
I just copied it over using multi stage builds, seems to be ok so far
FROM XXX
COPY --from=golang:1.13-alpine /usr/local/go/ /usr/local/go/
ENV PATH="/usr/local/go/bin:${PATH}"
The following Dockerfile worked for me. Simpler and more abstract.
FROM alpine:latest
RUN apk add --no-cache git make musl-dev go
# Configure Go
ENV GOROOT /usr/lib/go
ENV GOPATH /go
ENV PATH /go/bin:$PATH
RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin
# Install Glide
RUN go get -u github.com/Masterminds/glide/...
WORKDIR $GOPATH
CMD ["make"]
source: https://raw.githubusercontent.com/mickep76/alpine-golang/master/Dockerfile
Thanks BMitch.
I compiled the go source code and performed the below steps inside alpine image container.
echo "installing go version 1.10.3..."
apk add --no-cache --virtual .build-deps bash gcc musl-dev openssl go
wget -O go.tgz https://dl.google.com/go/go1.10.3.src.tar.gz
tar -C /usr/local -xzf go.tgz
cd /usr/local/go/src/
./make.bash
export PATH="/usr/local/go/bin:$PATH"
export GOPATH=/opt/go/
export PATH=$PATH:$GOPATH/bin
apk del .build-deps
go version
With Alpine, you have libmusl instead of glibc. Alpine's libmusl is not a 1 for 1 replacement. Code linked against glibc will show a not found error which is actually from the dynamic linker. You can see what libraries are linked to the binary with ldd:
/ # ldd /usr/local/go/bin/go
/lib64/ld-linux-x86-64.so.2 (0x7f63ceed1000)
libpthread.so.0 => /lib64/ld-linux-x86-64.so.2 (0x7f63ceed1000)
libc.so.6 => /lib64/ld-linux-x86-64.so.2 (0x7f63ceed1000)
There are two options. The preferred option, and one used by docker's go images on Alpine, is to compile the go binaries on Alpine. You can see this in the Dockerfile for the golang image: https://github.com/docker-library/golang/blob/69f2d2a132565bf60afc91813801a3bdcc981526/1.10/alpine3.8/Dockerfile
The other option is to install glibc on Alpine, but once you start doing things like that, I'd question why use Alpine at all, and whether Debian or CentOS would be a more appropriate base image for you. Alpine has a wiki topic on this and there are third parties that have created glibc packages for alpine.
I found the best way to get golang up running in alpine linux is to install it from source. This is also way followed in the official alpine go docker images.
FROM alpine:3.12
ARG GOLANG_VERSION=1.14.3
#we need the go version installed from apk to bootstrap the custom version built from source
RUN apk update && apk add go gcc bash musl-dev openssl-dev ca-certificates && update-ca-certificates
RUN wget https://dl.google.com/go/go$GOLANG_VERSION.src.tar.gz && tar -C /usr/local -xzf go$GOLANG_VERSION.src.tar.gz
RUN cd /usr/local/go/src && ./make.bash
ENV PATH=$PATH:/usr/local/go/bin
RUN rm go$GOLANG_VERSION.src.tar.gz
#we delete the apk installed version to avoid conflict
RUN apk del go
RUN go version
If the basic requirement is to have specific go version installed inside alpine based docker image then refer these images available on official golang dockerhub account.
docker pull golang:1.12-alpine
docker pull golang:1.11-alpine
Just in case someone encounters the same issue with me.
I was able to install the golang1.17.6 ion Alpine3.15 by following #Yogesh Jilhawar 's answer.
When I ran the command apk add --no-cache --virtual .build-deps bash gcc musl-dev openssl go, I got
ERROR: unable to select packages:
go (no such packages):
required by: world[go]
Then I tried to install the "gcc-go", it installs. After that, I can build the golang from the source successfully.
There Is the Alpine package, with the latest versione of golang:
pkg --update add go

Docker + older version of Elixir/Phoenix

I have been requested to move an Elixir/Phoenix app to Docker, with which I have no prior experience. The app uses non-latest versions of Elixir and Phoenix so I have had to diverge from the code online which generally focuses on latest versions. That led me to write this Dockerfile
# FROM bitwalker/alpine-elixir:latest
FROM bitwalker/alpine-elixir:1.3.4
MAINTAINER Paul Schoenfelder <paulschoenfelder#gmail.com>
# Important! Update this no-op ENV variable when this Dockerfile
# is updated with the current date. It will force refresh of all
# of the base images and things like `apt-get update` won't be using
# old cached versions when the Dockerfile is built.
ENV REFRESHED_AT=2017-07-26 \
# Set this so that CTRL+G works properly
TERM=xterm
# Install NPM
RUN \
mkdir -p /opt/app && \
chmod -R 777 /opt/app && \
apk update && \
apk --no-cache --update add \
git make g++ wget curl inotify-tools \
nodejs nodejs-current-npm && \
npm install npm -g --no-progress && \
update-ca-certificates --fresh && \
rm -rf /var/cache/apk/*
# Add local node module binaries to PATH
ENV PATH=./node_modules/.bin:$PATH \
HOME=/opt/app
# Install Hex+Rebar
RUN mix local.hex --force && \
mix local.rebar --force
WORKDIR /opt/app
CMD ["/bin/sh"]
<then it goes on to add some elixir depedencies>
On running
sudo docker build -t phoenix .
I'm ending up with this error and wondering how to get around it? Noting 'current' in the title I'm wondering whether using an older version of nodejs, and if so, how to do that? Beyond that I am open to any and all suggestions
ERROR: unsatisfiable constraints:
nodejs-current-npm (missing):
required by: world[nodejs-current-npm]
musl-1.1.14-r14:
breaks: musl-dev-1.1.14-r15[musl=1.1.14-r15]
That looks like bitwalker/alpine-elixir issue 5:
when using tagged images, you may sometimes need to explicitly upgrade packages, as the installed packages are at the versions found when building the image.
Generally it's as simple as adding apk --update upgrade before any commands which install packages.
Indeed, when you compare the old elixir 1.4.4-based Dockerfile, and the latest one, you will see an upgrade first in the latter:
apk --no-cache --update upgrade && \
apk add --no-cache --update --virtual .elixir-build \
...
Try and add that to your Dockerfile.

Resources