From 21b464ae8dab45f12efc2cb2a4c87c4261cbc487 Mon Sep 17 00:00:00 2001 From: Jay Date: Fri, 24 Aug 2018 20:30:28 +0800 Subject: [PATCH] add ci config, add docker file --- .drone.yml | 18 ++++++++++++++++++ Dockerfile | 10 ++++++++++ nginx.conf | 18 ++++++++++++++++++ 3 files changed, 46 insertions(+) create mode 100644 .drone.yml create mode 100644 Dockerfile create mode 100644 nginx.conf diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..f7e53fb --- /dev/null +++ b/.drone.yml @@ -0,0 +1,18 @@ +pipeline: + build: + image: node:8 + command: + - npm install + - BASE_URL=/web npm run build + when: + branch: release + docker: + image: plugins/docker + registry: docker.mtfos.xyz + repo: docker.mtfos.xyz/mtfos/bot_web + build_arg: + - PREFIX=/web + dockerfile: Dockerfile + tags: [latest, "${DRONE_COMMIT}"] + when: + branch: release \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..fae02b9 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,10 @@ +FROM nginx:alpine +LABEL maintainer="Jay " +ARG PREFIX +RUN mkdir -p /data +WORKDIR /data +COPY dist/ /data +COPY nginx.conf /etc/nginx/conf.d/default.conf +RUN sed -i 's@\$\$prefix\$\$@'${PREFIX}'@' /etc/nginx/conf.d/default.conf +EXPOSE 80 +CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..71974e8 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,18 @@ +server { + listen 80; + server_name localhost; + + #charset koi8-r; + #access_log /var/log/nginx/host.access.log main; + + root /data; + index index.html; + + location ^~ $$prefix$$/ { + alias /data/; + } + + location / { + try_files $uri $uri/ /index.html; + } +}