diff --git a/frontend/Dockerfile b/frontend/Dockerfile index 1b8e7119..c931f5ca 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -12,12 +12,14 @@ RUN apt-get update && \ # copy current workdir COPY package.json package.json COPY package-lock.json package-lock.json -COPY entrypoint.sh entrypoint.sh -RUN chmod +x entrypoint.sh # install packages RUN npm install RUN mv node_modules /tmp/node_modules +# copy entrypoint +COPY entrypoint.sh entrypoint.sh +RUN chmod +x entrypoint.sh + ENTRYPOINT [ "/usr/src/frontend/entrypoint.sh" ] CMD ["npm", "run", "build"] \ No newline at end of file diff --git a/scripts/entrypoint.sh b/scripts/entrypoint.sh index 219545b3..750a8226 100755 --- a/scripts/entrypoint.sh +++ b/scripts/entrypoint.sh @@ -10,11 +10,14 @@ else python manage.py collectstatic --noinput fi -# Copy pb2/grpc files if they do exist +# Print first start up message when pb2/grpc files if they do exist if [ ! -f "/usr/src/robosats/api/lightning/lightning_pb2.py" ]; then - echo "Looks like the first run of this container. pb2 and gRPC files were not detected on the attached volume, copying them into the attached volume /robosats/api/node ." - cp -R /tmp/* /usr/src/robosats/api/lightning/ + echo "Looks like the first run of this container. pb2 and gRPC files were not detected on the attached volume, copying them into the attached volume /robosats/api/lightning ." fi +# Copy and overwrite all existing pb2/grpc files always. Therefore, running +# /scripts/generate_grpc.sh only makes sense if done during Dockerfile build +cp -R /tmp/* /usr/src/robosats/api/lightning/ + # Start server / gunicorn / daphne / command exec "$@" \ No newline at end of file