A complete JavaScript example is available on the Basics page.
# EarthfileFROM node:13.10.1-alpine3.11WORKDIR /js-exampledeps:COPY package.json package-lock.json ./RUN npm installSAVE ARTIFACT package-lock.json AS LOCAL ./package-lock.jsonbuild:FROM +depsCOPY src srcCOPY dist distRUN npx webpackSAVE ARTIFACT dist /dist AS LOCAL distdocker:FROM +depsCOPY +build/dist ./distEXPOSE 8080ENTRYPOINT ["/js-example/node_modules/http-server/bin/http-server", "./dist"]SAVE IMAGE js-example:latest
For the complete code see the examples/js GitHub directory.