1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-24 20:36:40 +07:00

using docker-compose as builder

This commit is contained in:
Fedor Katurov 2020-11-16 15:15:42 +07:00
parent 6a0c25ed2b
commit 18e7b508c0
4 changed files with 46 additions and 4 deletions

View file

@ -58,12 +58,12 @@ steps:
script_stop: true script_stop: true
script: script:
- mkdir -p $${BUILD_PATH}/${DRONE_BRANCH} - mkdir -p $${BUILD_PATH}/${DRONE_BRANCH}
- rm -rf $${BUILD_PATH}/${DRONE_BRANCH}/*
- cd $${BUILD_PATH}/${DRONE_BRANCH} - cd $${BUILD_PATH}/${DRONE_BRANCH}
- rm -rf ./dist
- tar -xjf /tmp/vault-frontend-${DRONE_BRANCH}/app.tar.bz2 -C ./ - tar -xjf /tmp/vault-frontend-${DRONE_BRANCH}/app.tar.bz2 -C ./
- cp -a $${ENV_PATH}/${DRONE_BRANCH}/. $${BUILD_PATH}/${DRONE_BRANCH} - cp -a $${ENV_PATH}/${DRONE_BRANCH}/. $${BUILD_PATH}/${DRONE_BRANCH}
- yarn - docker-compose build
- yarn build - docker-compose up -d
- name: telgram_notify - name: telgram_notify
image: appleboy/drone-telegram image: appleboy/drone-telegram
when: when:
@ -79,4 +79,6 @@ steps:
message: > message: >
{{#success build.status}}🤓{{else}}😨{{/success}} {{#success build.status}}🤓{{else}}😨{{/success}}
{{ datetime build.finished "01.02.2006 15:04:05" "UTC" }} [{{repo.name}} / {{commit.branch}}]({{ build.link }}) {{ datetime build.finished "01.02.2006 15:04:05" "UTC" }} [{{repo.name}} / {{commit.branch}}]({{ build.link }})
```{{ commit.message }}``` ```
{{ commit.message }}
```

11
docker-compose.yml Normal file
View file

@ -0,0 +1,11 @@
version: '3'
services:
app:
restart: always
build:
context: .
dockerfile: docker/app/Dockerfile
ports:
- ${EXPOSE}:80
volumes:
- /etc/localtime:/etc/localtime:ro

13
docker/app/Dockerfile Normal file
View file

@ -0,0 +1,13 @@
# stage1 as builder
FROM node:10.13 as builder
COPY package.json yarn.lock ./
RUN yarn
COPY . .
RUN yarn build
FROM nginx:alpine
COPY docker/app/nginx.conf /etc/nginx/nginx.conf
RUN rm -rf /usr/share/nginx/html/*
COPY --from=builder /dist /usr/share/nginx/html
EXPOSE ${EXPOSE} 80
ENTRYPOINT ["nginx", "-g", "daemon off;"]

16
docker/app/nginx.conf Normal file
View file

@ -0,0 +1,16 @@
worker_processes 4;
events { worker_connections 1024; }
http {
server {
listen 80;
root /usr/share/nginx/html;
include /etc/nginx/mime.types;
location / {
try_files $uri /index.html;
}
}
}