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 arch: amd64
steps: steps:
- name: compress - name: build-master
image: alpine image: plugins/docker
commands:
- rm -rf ./app.tar.bz2
- tar -cjf ./app.tar.bz2 -C ./ .
- name: upload
image: drillster/drone-rsync
when: when:
branch: branch:
- master - master
- develop
environment: environment:
RSYNC_KEY: REACT_APP_API_HOST: https://pig.vault48.org/
from_secret: rsync_key REACT_APP_REMOTE_CURRENT: https://pig.vault48.org/static/
RSYNC_USER:
from_secret: rsync_user
PLUGIN_ARGS: -zz -O --no-perms
settings: settings:
port: 22522 dockerfile: docker/www/Dockerfile
hosts: build_args_from_env:
- vault48.org - REACT_APP_API_HOST
source: ./ - REACT_APP_REMOTE_CURRENT
user: ${rsync_user} tag:
key: ${rsync_key} - ${DRONE_BRANCH}
target: /tmp/vault-frontend-${DRONE_BRANCH} custom_labels:
include: - "commit=${DRONE_COMMIT_SHA}"
- "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
username: username:
from_secret: rsync_user from_secret: global_docker_login
key: password:
from_secret: rsync_key from_secret: global_docker_password
envs: [build_path, env_path] registry:
port: 22522 from_secret: global_docker_registry
script_stop: true repo:
script: from_secret: docker_repo
- mkdir -p $${BUILD_PATH}/${DRONE_BRANCH} - name: build-develop
- rm -rf $${BUILD_PATH}/${DRONE_BRANCH}/* image: plugins/docker
- 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
when: when:
status: branch:
- success - develop
- failure environment:
REACT_APP_API_HOST: https://pig.staging.vault48.org/
REACT_APP_REMOTE_CURRENT: https://pig.staging.vault48.org/static/
settings: settings:
token: dockerfile: docker/www/Dockerfile
from_secret: telegram_token build_args_from_env:
to: - REACT_APP_API_HOST
from_secret: telegram_chat_id - REACT_APP_REMOTE_CURRENT
format: markdown tag:
message: > - ${DRONE_BRANCH}
{{#success build.status}}🤓{{else}}😨{{/success}} custom_labels:
[{{repo.name}} / {{commit.branch}}]({{ build.link }}) - "commit=${DRONE_COMMIT_SHA}"
``` username:
{{ commit.message }} 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 /npm-debug.log
/.idea /.idea
/dist /dist
/.env

View file

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