zhuxc před 4 roky
rodič
revize
c6a9f2bb29
6 změnil soubory, kde provedl 41 přidání a 0 odebrání
  1. 5 0
      Dockerfile
  2. 10 0
      Dockerfile.builder
  3. 5 0
      Dockerfile.dev
  4. 7 0
      docker-auto-push.sh
  5. 3 0
      docker-entrypoint.sh
  6. 11 0
      docker-init.sh

+ 5 - 0
Dockerfile

@@ -0,0 +1,5 @@
+FROM nginx:stable-alpine
+RUN mkdir -p /usr/share/nginx/html
+COPY ./dist /usr/share/nginx/html
+COPY ./docker-init.sh /bin/
+CMD ["/bin/docker-init.sh"]

+ 10 - 0
Dockerfile.builder

@@ -0,0 +1,10 @@
+FROM node:alpine
+
+RUN cp /etc/apk/repositories /etc/apk/repositories.bak
+
+RUN echo "http://mirrors.aliyun.com/alpine/latest-stable/main/" > /etc/apk/repositories 
+RUN apk --no-cache add make g++ python
+
+WORKDIR /opt/web
+
+CMD ["node"]

+ 5 - 0
Dockerfile.dev

@@ -0,0 +1,5 @@
+FROM nginx:stable-alpine
+RUN mkdir -p /usr/share/nginx/html
+COPY ./dist /usr/share/nginx/html
+COPY ./docker-init.sh /bin/
+CMD ["/bin/docker-init.sh"]

+ 7 - 0
docker-auto-push.sh

@@ -0,0 +1,7 @@
+#!/bin/sh
+git pull
+docker build -t registry-platform.linkerplus.com/coursem/web-builder:1.0.0 -f Dockerfile.builder . && docker push registry-platform.linkerplus.com/coursem/web-builder:1.0.0
+rm -rf ./dist
+docker run --rm -i --user $(id -u) -v $(pwd):/opt/web registry-platform.linkerplus.com/coursem/web-builder:1.0.0 /bin/sh -c "npm --registry https://registry.npm.taobao.org install && npm rebuild node-sass && npm run build"
+docker build -t registry-platform.linkerplus.com/coursem/web-dev:1.0.0 -f Dockerfile.dev . && docker push registry-platform.linkerplus.com/coursem/web-dev:1.0.0
+docker build -t registry-platform.linkerplus.com/coursem/web:1.0.0 . && docker push registry-platform.linkerplus.com/coursem/web:1.0.0

+ 3 - 0
docker-entrypoint.sh

@@ -0,0 +1,3 @@
+#!/bin/sh
+
+npm run staging

+ 11 - 0
docker-init.sh

@@ -0,0 +1,11 @@
+#!/bin/sh
+
+if ! [[ -z "${BASE_API}" ]]; then
+    sed -i -e "s@https://apple.linkerplus.com/api@$BASE_API@g" /usr/share/nginx/html/static/js/app*.js
+fi
+
+if ! [[ -z "${LOGIN_API}" ]]; then
+    sed -i -e "s@https://linker-im.linkerplus.com/user/login@$LOGIN_API@g" /usr/share/nginx/html/static/js/app*.js
+fi
+
+nginx -g "daemon off;"