diff --git a/images/socketio/Dockerfile b/images/socketio/Dockerfile index db9c1dd2..fa28b92a 100644 --- a/images/socketio/Dockerfile +++ b/images/socketio/Dockerfile @@ -2,10 +2,20 @@ FROM alpine/git as builder ARG FRAPPE_VERSION ARG FRAPPE_REPO=https://github.com/frappe/frappe +RUN apk add -U jq RUN git clone --depth 1 -b ${FRAPPE_VERSION} ${FRAPPE_REPO} /opt/frappe +RUN jq --argjson dependencies "$(jq '.dependencies | INDEX( "express", "redis", "socket.io", "superagent" ) as $keep | \ + del( \ + . | objects | \ + .[ \ + keys_unsorted[] | \ + select( $keep[ . ] | not ) \ + ] \ + )' /opt/frappe/package.json)" '.dependencies = $dependencies | del(.scripts.prepare)' /opt/frappe/package.json > /opt/frappe/dependencies.json && \ + mv /opt/frappe/dependencies.json /opt/frappe/package.json - -FROM node:17-alpine +# NodeJS LTS +FROM node:18-alpine RUN addgroup -S frappe \ && adduser -S frappe -G frappe @@ -14,11 +24,10 @@ USER frappe WORKDIR /home/frappe/frappe-bench RUN mkdir -p sites apps/frappe -COPY --chown=frappe:frappe --from=builder /opt/frappe/socketio.js /opt/frappe/node_utils.js apps/frappe/ -COPY --chown=frappe:frappe package.json apps/frappe/ +COPY --chown=frappe:frappe --from=builder /opt/frappe/package.json /opt/frappe/socketio.js /opt/frappe/node_utils.js apps/frappe/ RUN cd apps/frappe \ - && npm install + && npm install --omit=dev WORKDIR /home/frappe/frappe-bench/sites diff --git a/images/socketio/package.json b/images/socketio/package.json deleted file mode 100644 index 04539034..00000000 --- a/images/socketio/package.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "name": "frappe-socketio", - "version": "1.0.1", - "description": "Frappe SocketIO Server", - "author": "Revant Nandgaonkar", - "license": "MIT", - "dependencies": { - "express": "^4.17.1", - "redis": "^3.1.1", - "socket.io": "^2.4.0", - "superagent": "^5.1.0" - } -}