Dockerfile 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. FROM node:18.17.1-alpine as build
  2. # Create link to node on amd64 so that corepack can find it
  3. RUN if [ "$(uname -m)" == "aarch64" ]; then mkdir -p /usr/local/sbin/ && ln -s /usr/local/bin/node /usr/local/sbin/node; fi
  4. WORKDIR /app
  5. COPY . /app/
  6. RUN apk --update add --virtual native-dep \
  7. make gcc g++ python3 libgcc libstdc++ git && \
  8. (cd /app && corepack yarn workspaces focus @uppy/companion) && \
  9. apk del native-dep
  10. RUN cd /app && corepack yarn workspace @uppy/companion build
  11. # Now remove all non-prod dependencies for a leaner image
  12. RUN cd /app && corepack yarn workspaces focus @uppy/companion --production
  13. FROM node:18.17.1-alpine
  14. WORKDIR /app
  15. # copy required files from build stage.
  16. COPY --from=build /app/packages/@uppy/companion/bin /app/bin
  17. COPY --from=build /app/packages/@uppy/companion/lib /app/lib
  18. COPY --from=build /app/packages/@uppy/companion/package.json /app/package.json
  19. COPY --from=build /app/packages/@uppy/companion/node_modules /app/node_modules
  20. ENV PATH "${PATH}:/app/node_modules/.bin"
  21. CMD ["node","/app/bin/companion"]
  22. # This can be overruled later
  23. EXPOSE 3020