Add YACD_DEFAULT_BACKEND env var for Docker image (#663)

This commit is contained in:
KAAAsS 2022-02-13 17:08:28 +08:00 committed by GitHub
parent 05691cc829
commit 95afc454d5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View file

@ -12,4 +12,6 @@ RUN yarn config set network-timeout 300000 \
FROM nginx:alpine
RUN rm -rf /usr/share/nginx/html/*
COPY --from=builder /app/public /usr/share/nginx/html
CMD ["nginx", "-g", "daemon off;"]
ENV YACD_DEFAULT_BACKEND "http://127.0.0.1:9090"
ADD docker-entrypoint.sh /
CMD ["/docker-entrypoint.sh"]

3
docker-entrypoint.sh Executable file
View file

@ -0,0 +1,3 @@
#!/bin/sh
sed -i "s|http://127.0.0.1:9090|$YACD_DEFAULT_BACKEND|" /usr/share/nginx/html/index.html
nginx -g "daemon off;"