nomad

HCL and Docker files for Nomad deployments
git clone https://git.in0rdr.ch/nomad.git
Log | Files | Refs | Pull requests

Dockerfile (1324B)


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