/entrypoint.sh: line 8: syntax error: unexpected end of file

Issue

Docker project was created on Linux machine, I’m running windows and I can’t get docker-compose up to work. I’ve read through Stackoverflow’s answers and so far I’ve tried the following (none have worked):

  • Using Visual Studio Code I saved as "LF" instead of CRLF
  • Deleted the file entirely, created a new one using Visual Studio Code, typed the words
  • Cut the entire file, pasted it in Notepad so that formatting gets cleared, copied and pasted back
  • Added various forms of #!/bin/bash to the start of the entrypoint.sh
  • Changed Docker File to use COPY instead of ADD

At this point I’m not sure what else to try. Any ideas?

Edit

entrypoint.sh

if [ "$1" == 'celery' ]; then
  celery -A vicmun worker -l info --uid=celery --gid=celery
else
  ./../wait_for_it.sh db:5433 --timeout=10
  python manage.py migrate
  python manage.py runserver 0.0.0.0:8000
fi

Dockerfile

FROM python:3.9
ENV PYTHONUNBUFFERED 1
ARG APP_ENV=${APP_ENV}
RUN mkdir /src
RUN mkdir /static
WORKDIR /src
ADD ./src /src
ADD entrypoint-${APP_ENV}.sh /entrypoint.sh
ADD wait_for_it.sh /wait_for_it.sh
RUN addgroup --system celery && adduser --system --ingroup celery celery
RUN ["chmod", "+x", "/wait_for_it.sh"]
RUN apt-get -y update
RUN apt-get -y install ffmpeg
RUN pip install -r requirements.txt
ENTRYPOINT ["bash", "/entrypoint.sh"]

enter image description here

Solution

Well, I feel the cringe for this. Turns out the solution was something I had already done, but it didn’t go through until I rebuilt with –no-cache option.

Solution was to:

  • Using Visual Studio Code I saved as "LF" instead of CRLF
  • and run docker-compose build --no-cache

Answered By – Chayemor

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published