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

Using custom registry (#75)

This commit is contained in:
muerwre 2021-09-30 14:54:52 +07:00 committed by GitHub
parent 6b06d46067
commit d5ed6c75d7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 48 additions and 73 deletions

View file

@ -7,78 +7,53 @@ platform:
arch: amd64
steps:
- name: compress
image: alpine
commands:
- rm -rf ./app.tar.bz2
- tar -cjf ./app.tar.bz2 -C ./ .
- name: upload
image: drillster/drone-rsync
- name: build-master
image: plugins/docker
when:
branch:
- master
- develop
environment:
RSYNC_KEY:
from_secret: rsync_key
RSYNC_USER:
from_secret: rsync_user
PLUGIN_ARGS: -zz -O --no-perms
REACT_APP_API_HOST: https://pig.vault48.org/
REACT_APP_REMOTE_CURRENT: https://pig.vault48.org/static/
settings:
port: 22522
hosts:
- vault48.org
source: ./
user: ${rsync_user}
key: ${rsync_key}
target: /tmp/vault-frontend-${DRONE_BRANCH}
include:
- "app.tar.bz2"
exclude:
- "*"
- name: build
image: appleboy/drone-ssh
when:
branch:
- master
- develop
environment:
BUILD_PATH:
from_secret: build_path
ENV_PATH:
from_secret: env_path
settings:
host: vault48.org
dockerfile: docker/www/Dockerfile
build_args_from_env:
- REACT_APP_API_HOST
- REACT_APP_REMOTE_CURRENT
tag:
- ${DRONE_BRANCH}
custom_labels:
- "commit=${DRONE_COMMIT_SHA}"
username:
from_secret: rsync_user
key:
from_secret: rsync_key
envs: [build_path, env_path]
port: 22522
script_stop: true
script:
- mkdir -p $${BUILD_PATH}/${DRONE_BRANCH}
- rm -rf $${BUILD_PATH}/${DRONE_BRANCH}/*
- cd $${BUILD_PATH}/${DRONE_BRANCH}
- tar -xjf /tmp/vault-frontend-${DRONE_BRANCH}/app.tar.bz2 -C ./
- cp -a $${ENV_PATH}/${DRONE_BRANCH}/. $${BUILD_PATH}/${DRONE_BRANCH}
- docker-compose build
- docker-compose up -d
- name: telgram_notify
image: appleboy/drone-telegram
from_secret: global_docker_login
password:
from_secret: global_docker_password
registry:
from_secret: global_docker_registry
repo:
from_secret: docker_repo
- name: build-develop
image: plugins/docker
when:
status:
- success
- failure
branch:
- develop
environment:
REACT_APP_API_HOST: https://pig.staging.vault48.org/
REACT_APP_REMOTE_CURRENT: https://pig.staging.vault48.org/static/
settings:
token:
from_secret: telegram_token
to:
from_secret: telegram_chat_id
format: markdown
message: >
{{#success build.status}}🤓{{else}}😨{{/success}}
[{{repo.name}} / {{commit.branch}}]({{ build.link }})
```
{{ commit.message }}
```
dockerfile: docker/www/Dockerfile
build_args_from_env:
- REACT_APP_API_HOST
- REACT_APP_REMOTE_CURRENT
tag:
- ${DRONE_BRANCH}
custom_labels:
- "commit=${DRONE_COMMIT_SHA}"
username:
from_secret: global_docker_login
password:
from_secret: global_docker_password
registry:
from_secret: global_docker_registry
repo:
from_secret: docker_repo

2
.env.development Normal file
View file

@ -0,0 +1,2 @@
REACT_APP_API_HOST: https://pig.staging.vault48.org/
REACT_APP_REMOTE_CURRENT: https://pig.staging.vault48.org/static/

View file

@ -1,3 +0,0 @@
REACT_APP_API_HOST = https://pig.staging.vault48.org/
REACT_APP_REMOTE_CURRENT = https://pig.staging.vault48.org/static/
EXPOSE = 4000

1
.gitignore vendored
View file

@ -2,4 +2,3 @@
/npm-debug.log
/.idea
/dist
/.env

View file

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