uppy/Dockerfile
2026-06-20 02:05:58 +05:30

35 lines
1.2 KiB
Docker

FROM node:22.22.1-alpine AS build
# Create link to node on amd64 so that corepack can find it
RUN if [ "$(uname -m)" == "aarch64" ]; then mkdir -p /usr/local/sbin/ && ln -s /usr/local/bin/node /usr/local/sbin/node; fi
WORKDIR /app
COPY . /app/
# Ensure corepack is enabled (available in official Node images) and
# install only build-time dependencies using a named virtual package.
RUN corepack enable && \
apk add --no-cache --virtual .build-deps build-base python3 libgcc libstdc++ git && \
(cd /app && corepack yarn workspaces focus @uppy/companion) && \
apk del .build-deps
RUN cd /app && corepack yarn workspace @uppy/companion build
# Now remove all non-prod dependencies for a leaner image
RUN cd /app && corepack yarn workspaces focus @uppy/companion --production
FROM node:22.22.1-alpine
WORKDIR /app
# copy required files from build stage.
COPY --from=build /app/packages/@uppy/companion/dist /app/dist
COPY --from=build /app/packages/@uppy/companion/package.json /app/package.json
COPY --from=build /app/packages/@uppy/companion/node_modules /app/node_modules
ENV PATH "${PATH}:/app/node_modules/.bin"
CMD ["node","/app/dist/bin/companion.js"]
# This can be overruled later
EXPOSE 3020