add ci config, add docker file

This commit is contained in:
Jay 2018-08-24 20:30:28 +08:00
parent e90080e1e1
commit 21b464ae8d
3 changed files with 46 additions and 0 deletions

18
.drone.yml Normal file
View File

@ -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

10
Dockerfile Normal file
View File

@ -0,0 +1,10 @@
FROM nginx:alpine
LABEL maintainer="Jay <admin@trj.tw>"
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;"]

18
nginx.conf Normal file
View File

@ -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;
}
}