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 (1159B)


      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 ARG VITE_API_URI='http://127.0.0.1'
     10 ARG VITE_API_PORT=8000
     11 ARG VITE_SESSION_TTL=3600
     12 ARG VITE_WS_URI='ws://127.0.0.1'
     13 ARG VITE_WS_PORT=8000
     14 ARG VITE_LOCALE='en-US'
     15 
     16 # Configure the env with the args
     17 ENV NODE_ENV="$NODE_ENV"
     18 ENV VITE_APP_DOC_TITLE="$VITE_APP_DOC_TITLE"
     19 ENV VITE_API_URI="$VITE_API_URI"
     20 ENV VITE_API_PORT="$VITE_API_PORT"
     21 ENV VITE_SESSION_TTL="$VITE_SESSION_TTL"
     22 ENV VITE_WS_URI="$VITE_WS_URI"
     23 ENV VITE_WS_PORT="$VITE_WS_PORT"
     24 ENV VITE_LOCALE="$VITE_LOCALE"
     25 
     26 WORKDIR /app
     27 COPY . /app
     28 
     29 # Install npm dependencies to node_modules
     30 # https://docs.npmjs.com/cli/v10/commands/npm-ci
     31 RUN npm ci
     32 RUN npm run build
     33 
     34 FROM docker.io/nginx:alpine
     35 
     36 # Install the static files
     37 RUN rm -rf /usr/share/nginx/html/*
     38 COPY --from=builder /app/dist/ /usr/share/nginx/html/
     39 
     40 # Install config file
     41 RUN rm -rf /etc/nginx/conf.d/*
     42 COPY dockerfiles/frontend/myheats.conf /etc/nginx/conf.d/
     43 
     44 CMD ["nginx", "-g", "daemon off;"]