33 lines
785 B
Docker
33 lines
785 B
Docker
FROM node:latest as builder
|
|
|
|
# automatically creates the dir and sets it as the current working dir
|
|
WORKDIR /usr/src/app
|
|
# this will allow us to run vite and other tools directly
|
|
ENV PATH /usr/src/node_modules/.bin:$PATH
|
|
|
|
# inject all environment vars we'll need
|
|
ARG VITE_BACKEND_URL
|
|
# expose the variable to the finished cotainer
|
|
ENV VITE_BACKEND_URL=$VITE_BACKEND_URL
|
|
|
|
COPY package.json ./
|
|
|
|
RUN npm install
|
|
|
|
COPY . ./
|
|
|
|
RUN npm run build
|
|
|
|
FROM busybox:1.35
|
|
|
|
# Create a non-root user to own the files and run our server
|
|
RUN adduser -D static
|
|
USER static
|
|
WORKDIR /home/static
|
|
|
|
# Copy the static website
|
|
# Use the .dockerignore file to control what ends up inside the image!
|
|
COPY --from=builder /usr/src/app/dist ./
|
|
|
|
# Run BusyBox httpd
|
|
CMD ["busybox", "httpd", "-f", "-v", "-p", "3000"] |