myheats

Live heats, scoring and leaderboard for sport events
git clone https://git.in0rdr.ch/myheats.git
Log | Files | Refs | Pull requests |Archive | README | LICENSE

Dockerfile (934B)


      1 FROM docker.io/node:18-alpine AS builder
      2 
      3 # use NODE_ENV=prod to exclude the `devDependencies` (e..g, vite)
      4 # we require `vite` command in `npm run build` below
      5 ARG NODE_ENV=dev
      6 
      7 # Read args from build command
      8 ARG VITE_APP_DOC_TITLE='My Heats'
      9 
     10 # Configure the env with the args
     11 ENV NODE_ENV="$NODE_ENV"
     12 ENV VITE_APP_DOC_TITLE="$VITE_APP_DOC_TITLE"
     13 
     14 RUN apk update && apk add --no-cache git
     15 
     16 WORKDIR /app
     17 RUN git clone --depth 1 https://git.in0rdr.ch/myheats.git /app
     18 
     19 # install npm dependencies to node_modules
     20 # https://docs.npmjs.com/cli/v10/commands/npm-ci
     21 RUN npm ci
     22 
     23 # vite static build (for production)
     24 # https://vitejs.dev/guide/build
     25 RUN npm run build
     26 
     27 FROM docker.io/nginx:alpine
     28 
     29 # install the static files
     30 RUN rm -rf /usr/share/nginx/html/*
     31 COPY --from=builder /app/dist/ /usr/share/nginx/html/
     32 
     33 # install config file
     34 RUN rm -rf /etc/nginx/conf.d/*
     35 COPY myheats.conf /etc/nginx/conf.d/
     36 
     37 CMD ["nginx", "-g", "daemon off;"]