diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..f8d1a08 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,4 @@ +dist +node_modules +.git +.idea diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..69692b7 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,26 @@ +FROM node:20-alpine AS build + +WORKDIR /build + +# install packages first +COPY package* . +RUN npm ci + +# copy everything else and run the build +COPY . . +RUN npm run build + +FROM busybox:1.37 AS httpd + +# add user to run web server as +RUN adduser -D static +USER static +WORKDIR /home/static + +# copy build files from the node worker +COPY --from=build /build/dist /home/static + +EXPOSE 3000 +# run httpd in foreground, verbose, on port 3000 +CMD ["busybox", "httpd", "-f", "-v", "-p", "3000"] +