timvisee / send

:mailbox_with_mail: Simple, private file sharing. Mirror of https://gitlab.com/timvisee/send

Home Page:https://send.vis.ee

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fix permission on upload folder in docker

DeAlexPesh opened this issue · comments

Dockerfile

FROM node:16.13-alpine3.13 AS base
RUN apk add --no-cache git \
 && git clone https://github.com/timvisee/send.git /home/send \
 && mv -f /home/send /app
WORKDIR /app

FROM base AS build
RUN PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true npm ci \
 && npm run build

FROM node:16.13-alpine3.13 AS prod
RUN set -x \
 && apk --no-cache add shadow \
 && groupmod -g 1001 node \
 && usermod -u 1001 -g 1001 node \
 && set -x \
 && addgroup --gid 1000 app \
 && adduser --disabled-password --gecos '' --ingroup app --home /app --uid 1000 app \
 && mkdir -p /uploads \
 && chown app:app -R /uploads
USER app
WORKDIR /app
COPY --chown=app:app --from=base /app/package*.json ./
COPY --chown=app:app --from=base /app/app app
COPY --chown=app:app --from=base /app/common common
COPY --chown=app:app --from=base /app/public/locales public/locales
COPY --chown=app:app --from=base /app/server server
COPY --chown=app:app --from=build /app/dist dist
RUN npm ci --production \
 && npm cache clean --force \
 && mkdir -p /app/.config/configstore \
 && ln -s dist/version.json version.json
VOLUME /uploads
ENV PORT=1443
EXPOSE ${PORT}
CMD ["node", "server/bin/prod.js"]

docker-compose

version: "3"
...
  volumes:
   - "uploads:/uploads"
...
volumes:
 uploads:
  driver: local
  driver_opts:
   o: bind
   type: none
   device: /folder_of_uploads

Your new repository is not much different from this, except that the node version has changed to node:20-alpine3.17, but:

1.683 npm WARN EBADENGINE Unsupported engine {
1.684 npm WARN EBADENGINE   package: 'send@3.4.24',
1.684 npm WARN EBADENGINE   required: { node: '^16.13.0' },
1.684 npm WARN EBADENGINE   current: { node: 'v20.5.0', npm: '9.8.0' }
1.684 npm WARN EBADENGINE }

and

29.64 /app/node_modules/webpack-cli/bin/cli.js:93
29.64                           throw err;
29.64                           ^
29.64
29.64 Error: Cannot find module './test/frontend/index.js'

and chmod 777 - this is not a solution, for this they beat on the hands.

Fixed!

nope