Move to Forgejo #1

Merged
Varakh merged 1 commit from feature/move-to-forgejo into master 2023-08-17 19:17:35 +00:00
4 changed files with 96 additions and 79 deletions

View file

@ -1,75 +0,0 @@
---
kind: pipeline
type: docker
name: default
trigger:
event:
include:
- push
- cron
branch:
- master
environment: &default_environment
REVISION: ${DRONE_COMMIT_SHA}
CREATED: ${DRONE_BUILD_CREATED}
SOURCE_URL: ${DRONE_GIT_HTTP_URL}
# also change in 'tags' of build docker
FB_VERSION: 4.0.0
BUILD_DIR: /drone/src/fb_src
steps:
- name: prepare environment and build clone file bin
image: alpine
commands:
- apk update
- apk add git bash
- bash -c "[[ -d $BUILD_DIR ]] && rm -rf $BUILD_DIR || echo 'Nothing to clean'"
- git config --global advice.detachedHead false
- git clone --branch $FB_VERSION https://github.com/Bluewind/filebin --depth=1 $BUILD_DIR
- rm -rf $BUILD_DIR/.git
- name: build docker image
image: plugins/docker
environment:
<<: *default_environment
settings:
purge: true
repo: varakh/filebin
username:
from_secret: dockerhub_user
password:
from_secret: dockerhub_key
tags:
- latest
- 4.0.0
- name: clean up
image: alpine
commands:
- apk update
- apk add bash
- bash -c "[[ -d $BUILD_DIR ]] && rm -rf $BUILD_DIR || echo 'Nothing to clean'"
- name: notify
image: drillster/drone-email
settings:
subject: "Build failed"
body: "URL ${DRONE_BUILD_LINK}"
host:
from_secret: mail_host
username:
from_secret: mail_user
password:
from_secret: mail_password
from:
from_secret: mail_from
when:
status:
- failure
---
kind: signature
hmac: e2f9c0fce3829d85c03a504223fb6bb595a14061f9771b9c9f0e6a52548a6102
...

View file

@ -0,0 +1,33 @@
on: [ push ]
env:
FB_VERSION: 4.0.0
REVISION: ${{ github.sha }}
jobs:
build:
runs-on: docker
container:
image: alpine:3.18
steps:
- name: Prepare requirements
run: |
apk add --no-cache nodejs npm git
apk add --no-cache docker docker-cli-buildx
- uses: actions/checkout@v3
name: Clone
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_KEY }}
- name: Build docker image
uses: docker/build-push-action@v4
with:
build-args: FB_VERSION=${{ env.FB_VERSION }}
push: false
tags: varakh/ts3web:${{ github.sha }}

View file

@ -0,0 +1,37 @@
on:
push:
branches:
- master
env:
FB_VERSION: 4.0.0
REVISION: ${{ github.sha }}
jobs:
build:
runs-on: docker
container:
image: alpine:3.18
steps:
- name: Prepare requirements
run: |
apk add --no-cache nodejs npm git
apk add --no-cache docker docker-cli-buildx
- uses: actions/checkout@v3
name: Clone
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_KEY }}
- name: Build docker image
uses: docker/build-push-action@v4
with:
build-args: FB_VERSION=${{ env.FB_VERSION }}
push: true
tags: varakh/filebin:latest,varakh/filebin:${{ env.FB_VERSION }}

View file

@ -1,4 +1,29 @@
#
# Build image
#
FROM alpine:3 as builder
ARG FB_VERSION
ARG FB_SOURCE_URL="https://github.com/Bluewind/filebin"
ARG FB_CLONE_DEPTH=1
LABEL maintainer="Varakh <varakh@varakh.de>"
RUN mkdir -p /app
WORKDIR /app
RUN echo $FB_VERSION && \
echo $FB_SOURCE_URL && \
echo $FB_CLONE_DEPTH
RUN apk add --update --no-cache git && \
git config --global advice.detachedHead false && \
git clone --branch ${FB_VERSION} "${FB_SOURCE_URL}" --depth=${FB_CLONE_DEPTH} /app/fb_src && \
rm -rf /app/fb_src/.git
FROM alpine:3 FROM alpine:3
COPY --from=builder /app/fb_src /var/www
LABEL maintainer="Varakh <varakh@varakh.de>" \ LABEL maintainer="Varakh <varakh@varakh.de>" \
description="filebin" \ description="filebin" \
@ -7,9 +32,7 @@ LABEL maintainer="Varakh <varakh@varakh.de>" \
org.opencontainers.image.vendor="Varakh" \ org.opencontainers.image.vendor="Varakh" \
org.opencontainers.image.title="filebin" \ org.opencontainers.image.title="filebin" \
org.opencontainers.image.description="filebin" \ org.opencontainers.image.description="filebin" \
org.opencontainers.image.base.name="alpine:3" \ org.opencontainers.image.base.name="alpine:3"
org.opencontainers.artifact.created=${CREATED} \
org.opencontainers.image.source=${SOURCE_URL}
ENV RECONFIGURE=true \ ENV RECONFIGURE=true \
MIGRATE=true \ MIGRATE=true \
@ -56,7 +79,6 @@ ENV RECONFIGURE=true \
SMTP_PASS='' SMTP_PASS=''
ADD src/wait-for.sh /wait-for.sh ADD src/wait-for.sh /wait-for.sh
ADD fb_src/ /var/www
# install dependencies # install dependencies
RUN chmod -x /wait-for.sh && \ RUN chmod -x /wait-for.sh && \