From 44b497c2efa6d11ffd1af93fe1ca48978f8f051a Mon Sep 17 00:00:00 2001 From: Varakh Date: Thu, 17 Aug 2023 09:27:47 +0200 Subject: [PATCH] Move to Forgejo --- .drone.yml | 75 --------------------------------- .forgejo/workflows/build.yaml | 33 +++++++++++++++ .forgejo/workflows/release.yaml | 37 ++++++++++++++++ Dockerfile | 30 +++++++++++-- 4 files changed, 96 insertions(+), 79 deletions(-) delete mode 100644 .drone.yml create mode 100644 .forgejo/workflows/build.yaml create mode 100644 .forgejo/workflows/release.yaml diff --git a/.drone.yml b/.drone.yml deleted file mode 100644 index f024c02..0000000 --- a/.drone.yml +++ /dev/null @@ -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 - -... diff --git a/.forgejo/workflows/build.yaml b/.forgejo/workflows/build.yaml new file mode 100644 index 0000000..038bdd1 --- /dev/null +++ b/.forgejo/workflows/build.yaml @@ -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 }} diff --git a/.forgejo/workflows/release.yaml b/.forgejo/workflows/release.yaml new file mode 100644 index 0000000..0bc5f58 --- /dev/null +++ b/.forgejo/workflows/release.yaml @@ -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 }} + diff --git a/Dockerfile b/Dockerfile index 9837580..00abf1b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 " + +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 +COPY --from=builder /app/fb_src /var/www LABEL maintainer="Varakh " \ description="filebin" \ @@ -7,9 +32,7 @@ LABEL maintainer="Varakh " \ org.opencontainers.image.vendor="Varakh" \ org.opencontainers.image.title="filebin" \ org.opencontainers.image.description="filebin" \ - org.opencontainers.image.base.name="alpine:3" \ - org.opencontainers.artifact.created=${CREATED} \ - org.opencontainers.image.source=${SOURCE_URL} + org.opencontainers.image.base.name="alpine:3" ENV RECONFIGURE=true \ MIGRATE=true \ @@ -56,7 +79,6 @@ ENV RECONFIGURE=true \ SMTP_PASS='' ADD src/wait-for.sh /wait-for.sh -ADD fb_src/ /var/www # install dependencies RUN chmod -x /wait-for.sh && \