mirror of
https://github.com/fbartels/cloudron-drone-app.git
synced 2025-01-09 10:45:28 +00:00
Simplify build process (#2)
switch cli helper to dind base use local socket in all steps ignore tags file use txt file format for secrets
This commit is contained in:
parent
66ba25d5fe
commit
1361023637
4 changed files with 47 additions and 28 deletions
60
.drone.yml
60
.drone.yml
|
@ -4,40 +4,56 @@ type: docker
|
||||||
name: default
|
name: default
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: cloudron build & update
|
- name: set version
|
||||||
image: fbartels/cloudron-cli
|
image: golang:1.12
|
||||||
|
commands:
|
||||||
|
- "current_version=$(grep drone/drone: Dockerfile | cut -d' ' -f 2 | cut -d: -f 2)"
|
||||||
|
- timestamp=$(date +%s)
|
||||||
|
- echo -n "$current_version-$timestamp" > .tags
|
||||||
|
- name: docker build
|
||||||
|
image: docker:dind
|
||||||
|
volumes:
|
||||||
|
- name: dockersock
|
||||||
|
path: /var/run
|
||||||
|
commands:
|
||||||
|
- docker ps -a
|
||||||
|
- docker build -t fbartels/com.github.drone:latest .
|
||||||
|
- name: docker push
|
||||||
|
image: docker:dind
|
||||||
volumes:
|
volumes:
|
||||||
- name: dockersock
|
- name: dockersock
|
||||||
path: /var/run
|
path: /var/run
|
||||||
environment:
|
environment:
|
||||||
DOCKER_USERNAME: {from_secret: DOCKER_USERNAME}
|
DOCKER_USERNAME: {from_secret: DOCKER_USERNAME}
|
||||||
DOCKER_PASSWORD: {from_secret: DOCKER_PASSWORD}
|
DOCKER_PASSWORD: {from_secret: DOCKER_PASSWORD}
|
||||||
|
commands:
|
||||||
|
- current_version=$(cat .tags)
|
||||||
|
- docker tag fbartels/com.github.drone:latest fbartels/com.github.drone:$current_version
|
||||||
|
- echo $DOCKER_PASSWORD | docker login -u $DOCKER_USERNAME --password-stdin
|
||||||
|
- docker push fbartels/com.github.drone:latest
|
||||||
|
- docker push fbartels/com.github.drone:$current_version
|
||||||
|
when:
|
||||||
|
branch:
|
||||||
|
- master
|
||||||
|
event:
|
||||||
|
exclude:
|
||||||
|
- pull_request
|
||||||
|
- name: cloudron update
|
||||||
|
image: fbartels/cloudron-cli:latest
|
||||||
|
environment:
|
||||||
CLOUDRON_SERVER: {from_secret: CLOUDRON_SERVER}
|
CLOUDRON_SERVER: {from_secret: CLOUDRON_SERVER}
|
||||||
CLOUDRON_TOKEN: {from_secret: CLOUDRON_TOKEN}
|
CLOUDRON_TOKEN: {from_secret: CLOUDRON_TOKEN}
|
||||||
commands:
|
commands:
|
||||||
- dockerize -wait file:///var/run/docker.sock -timeout 60s
|
- current_version=$(cat .tags)
|
||||||
- docker ps -a
|
- cloudron update --server $CLOUDRON_SERVER --token $CLOUDRON_TOKEN --app drone --image fbartels/com.github.drone:$current_version
|
||||||
- echo $DOCKER_PASSWORD | docker login -u $DOCKER_USERNAME --password-stdin
|
|
||||||
- make build
|
|
||||||
- make update-ci
|
|
||||||
when:
|
when:
|
||||||
branch:
|
branch:
|
||||||
include:
|
|
||||||
- master
|
|
||||||
|
|
||||||
services:
|
|
||||||
- name: docker
|
|
||||||
image: docker:dind
|
|
||||||
privileged: true
|
|
||||||
command: [ --storage-driver=aufs]
|
|
||||||
volumes:
|
|
||||||
- name: dockersock
|
|
||||||
path: /var/run
|
|
||||||
when:
|
|
||||||
branch:
|
|
||||||
include:
|
|
||||||
- master
|
- master
|
||||||
|
event:
|
||||||
|
exclude:
|
||||||
|
- pull_request
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
- name: dockersock
|
- name: dockersock
|
||||||
temp: {}
|
host:
|
||||||
|
path: /var/run/
|
||||||
|
|
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,2 +1,4 @@
|
||||||
.env
|
.env
|
||||||
runner/.env
|
runner/.env
|
||||||
|
secrets.txt
|
||||||
|
.tags
|
||||||
|
|
|
@ -44,13 +44,13 @@ drone info
|
||||||
You can also run pipelines directly with the Drone CLI:
|
You can also run pipelines directly with the Drone CLI:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
drone exec --secret-file drone_secrets.yaml .drone.yml
|
drone exec --secret-file secrets.txt .drone.yml
|
||||||
```
|
```
|
||||||
|
|
||||||
A template for `drone-secrets.yaml`:
|
A template for `secrets.txt`:
|
||||||
|
|
||||||
```yaml
|
```bash
|
||||||
slack_url: https://hooks.slack.com/services/xxxxxxxxxxxx
|
slack_url=https://hooks.slack.com/services/xxxxxxxxxxxx
|
||||||
```
|
```
|
||||||
|
|
||||||
### Adding secrets through CLI
|
### Adding secrets through CLI
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
FROM plugins/docker:latest
|
FROM docker:dind
|
||||||
RUN apk add --no-cache jq make npm perl python
|
# hadolint ignore=DL3018
|
||||||
|
RUN apk add --no-cache jq make npm perl python3
|
||||||
ENV DOCKERIZE_VERSION v0.6.1
|
ENV DOCKERIZE_VERSION v0.6.1
|
||||||
RUN wget https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-alpine-linux-amd64-$DOCKERIZE_VERSION.tar.gz && \
|
RUN wget https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-alpine-linux-amd64-$DOCKERIZE_VERSION.tar.gz && \
|
||||||
tar -C /usr/local/bin -xzvf dockerize-alpine-linux-amd64-$DOCKERIZE_VERSION.tar.gz && \
|
tar -C /usr/local/bin -xzvf dockerize-alpine-linux-amd64-$DOCKERIZE_VERSION.tar.gz && \
|
||||||
|
|
Loading…
Reference in a new issue