I have an application in dockerfile where it is necessary to call a .sh file to download packages, but there is always an error when calling this file.
My dockerfile is:
FROM alpine:3.12 as builder
ARG VERSION=7.16.0
ARG DISTRO=tomcat
ARG SNAPSHOT=true
ARG JMX_PROMETHEUS_VERSION=0.12.0
RUN apk add --no-cache \
bash \
ca-certificates \
maven \
tar \
wget \
xmlstarlet
COPY settings.xml download.sh camunda-run.sh camunda-tomcat.sh camunda-wildfly.sh /tmp/
RUN /tmp/download.sh
FROM alpine:3.12
RUN apk add --no-cache \
bash \
ca-certificates \
curl \
openjdk11-jre-headless \
tzdata \
tini \
xmlstarlet \
&& curl -o /usr/local/bin/wait-for-it.sh \
"https://raw.githubusercontent.com/vishnubob/wait-for-it/a454892f3c2ebbc22bd15e446415b8fcb7c1cfa4/wait-for-it.sh" \
&& chmod +x /usr/local/bin/wait-for-it.sh
RUN addgroup -g 1000 -S camunda && \
adduser -u 1000 -S camunda -G camunda -h /camunda -s /bin/bash -D camunda
WORKDIR /camunda
USER camunda
ENTRYPOINT ["/sbin/tini", "--"]
CMD ["./camunda.sh"]
COPY --chown=camunda:camunda --from=builder /camunda .
My download.sh file looks exactly like this: https://github.com/camunda/docker-camunda-bpm-platform/blob/next/download.sh
When running the command: docker build . -t servicecamundadocker/latest
i get the error:
=> ERROR [builder 4/4] RUN /tmp/download.sh 0.2s ------
> [builder 4/4] RUN /tmp/download.sh:
#11 0.216 /bin/sh: illegal option -
------
Does anyone know how to fix this error? Thanks
ash
(although/bin/sh
might be an alias for that) so maybe the-ex
used in that script is not supported ... Can you try to execute that script in a interactive plain alpine container ?/bin/sh -ex
,-e
exits when not in interactive mode (it says in the docs that -If not interactive, exit immediately if any untested command fails
) can you remove it and try again?