In the shell script that is run during deploy, "#! /usr/bin/env bash" in the shell script executed during deploy appears to cause an error

I am trying to install google chrome by running a shell script in a “Dockerfile” to run selenium.
I am referring to the following.

However, there seems to be an error in the shell script, and the leading “#! /usr/bin/env bash” and there seems to be an error in “#! /usr/bin/env bash” only, but the error still occurs.
The Logs page on Render.com says "error: failed to solve: process “/bin/sh -c chmod +x render-build.sh && render-build.sh” did not complete successfully: exit I cannot get any details of the error, only “code: 127”.
Incidentally, “#! /bin/sh” only, no error occurred.

If I use “#! /usr/bin/env bash”, do I need to set any environment variables in Render.com to use it?

Currently, we are using free plan for the trial stage.

The source is as follows.

■ render-build.sh

#!/usr/bin/env bash

■ Dockerfile

FROM maven:3.9.6-eclipse-temurin-21 AS build
COPY . .
RUN mvn clean package -Dmaven.test.skip=true
FROM eclipse-temurin:21-alpine

# Javaアプリケーションのjarをコピー
COPY --from=build /target/xbot-nonmoral.jar xbot-nonmoral.jar

# ローカルのrender-build.shをコピー
COPY render-build.sh .

# render-build.shに実行権限を付与
# render-build.shを実行
RUN chmod +x render-build.sh \
    && render-build.sh

# seleniumの設定
ENV PATH="${PATH}:/opt/render/project/.render/chrome/opt/google/chrome/"

EXPOSE 8080
ENTRYPOINT ["java", "-jar", "xbot-nonmoral.jar"]

The site I referred to was missing.
We refer to the following.

try puting a ./ in front of render-build.sh, remember on linux the current directory is not in your path.

RUN chmod +x render-build.sh && ./render-build.sh

hope that works

Thanks for letting me know.

Thanks to you, I have seen changes in Log.
It still seems to be saying that bash is missing.
How can I get it to find it?

Before

0.047 /bin/sh: render-build.sh: not found

After

※ As a new user, only one image can be posted, so only the “After” will be available.

Self resolved.

I got it to work by installing git and git-secrets below.

FROM node:16-alpine3.16
RUN apk update && \
    apk add bash git make && \
    apk add --upgrade grep
RUN git clone https://github.com/awslabs/git-secrets /home/alpine/git-secrets
WORKDIR /home/alpine/git-secrets
RUN make && make install

Thank you very much.

The maven image appears to be alpine based and doesn’t ship bash by default, only a /bin/sh executable which is probably busybox or something similarly minimal. You resolved it not by installing git, but by installing bash.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.