FROM nginx:alpine
COPY nginx.conf.template /etc/nginx/conf.d/nginx.conf.template
RUN rm -rf /usr/share/nginx/html/*
COPY ./dist/open-redirect/browser/ /usr/share/nginx/html
RUN apk update
RUN apk add bash

ARG VERSION
RUN echo "{\"version\": \"${VERSION}\"}" > /usr/share/nginx/html/assets/version.json

CMD /bin/bash -c "envsubst '\$CONTAINER_NAME' < /etc/nginx/conf.d/nginx.conf.template > /etc/nginx/nginx.conf; nginx -g 'daemon off;'"
