From 706c6551b5313e283adfc103dd1f56f2800d062a Mon Sep 17 00:00:00 2001 From: Pierre-Henry Soria Date: Tue, 7 May 2024 21:04:37 +1000 Subject: [PATCH] Enhance Dockerfile --- Dockerfile | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6ae65f5..e3a13da 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,22 +1,31 @@ FROM searxng/searxng:2024.4.29-e45a7cc06 + ENV PORT ${PORT:-7860} EXPOSE ${PORT} -RUN apk add --update \ + +RUN apk add --update --no-cache \ nodejs \ npm \ git + RUN sed -i 's/- html/- json/' /usr/local/searxng/searx/settings.yml \ && sed -i 's/su-exec searxng:searxng //' /usr/local/searxng/dockerfiles/docker-entrypoint.sh \ && mkdir -p /etc/searxng \ && chmod 777 /etc/searxng + ARG USERNAME=user RUN adduser -D -u 1000 ${USERNAME} \ && mkdir -p /home/${USERNAME}/app \ && chown -R ${USERNAME}:${USERNAME} /home/${USERNAME} -USER user -WORKDIR /home/${USERNAME}/app + +USER ${USERNAME} +WORKDIR /home/${USERNAME}/app + +COPY --chown=${USERNAME}:${USERNAME} package*.json ./ +RUN npm ci + COPY --chown=${USERNAME}:${USERNAME} . . -RUN npm ci \ - && npm run build -ENTRYPOINT [ "/bin/sh", "-c" ] -CMD [ "/usr/local/searxng/dockerfiles/docker-entrypoint.sh -f & npm start -- --host" ] +RUN npm run build + +ENTRYPOINT ["/bin/sh", "-c"] +CMD ["/usr/local/searxng/dockerfiles/docker-entrypoint.sh -f & npm start -- --host"]