refactoring
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Robert Kaussow 2020-02-22 17:32:27 +01:00
parent 569f9eb837
commit 9ad6505c39
6 changed files with 73 additions and 73 deletions

View File

@ -1,5 +1,4 @@
local PipelineBuild(arch='amd64') = {
local tag = 'linux-' + arch,
kind: 'pipeline',
name: 'build-container-' + arch,
platform: {
@ -11,27 +10,19 @@ local PipelineBuild(arch='amd64') = {
name: 'binary',
image: 'clux/muslrust:nightly-2019-12-19',
environment: {
DB: 'postgresql',
DEBIAN_FRONTEND: 'noninteractive',
LANG: 'C.UTF-8',
TZ: 'UTC',
BUILD_VERSION: '${DRONE_TAG%-*}',
},
commands: [
'[ -z "${DRONE_TAG}" ] && LDAP_VERSION=master || LDAP_VERSION="${DRONE_TAG%-*}"',
'mkdir -p source/',
'rustup set profile minimal',
'curl -sSL https://github.com/ViViDboarder/bitwarden_rs_ldap/archive/"$$LDAP_VERSION".tar.gz | tar xz -C source/ --strip-components=1',
"grep -rlI 'Box<Error>' source/src/ | xargs sed -i 's/Box<Error>/Box<dyn Error>/g'",
'cd source/ && cargo build -j 8 --release',
'make build',
],
},
{
name: 'dryrun',
image: 'plugins/docker:' + tag,
image: 'plugins/docker',
settings: {
dry_run: true,
dockerfile: 'Dockerfile.' + arch,
repo: 'xoxys/bitwardenrs_ldap',
dockerfile: 'Dockerfile',
repo: 'xoxys/${DRONE_REPO_NAME}',
username: { from_secret: 'docker_username' },
password: { from_secret: 'docker_password' },
},
@ -43,12 +34,12 @@ local PipelineBuild(arch='amd64') = {
},
{
name: 'publish',
image: 'plugins/docker:' + tag,
image: 'plugins/docker',
settings: {
auto_tag: true,
auto_tag_suffix: arch,
dockerfile: 'Dockerfile.' + arch,
repo: 'xoxys/bitwardenrs_ldap',
dockerfile: 'Dockerfile',
repo: 'xoxys/${DRONE_REPO_NAME}',
username: { from_secret: 'docker_username' },
password: { from_secret: 'docker_password' },
},
@ -112,7 +103,7 @@ local PipelineNotifications(depends_on=[]) = {
DOCKERHUB_USERNAME: { from_secret: 'docker_username' },
DOCKERHUB_PASSWORD: { from_secret: 'docker_password' },
DOCKERHUB_REPO_PREFIX: 'xoxys',
DOCKERHUB_REPO_NAME: 'bitwardenrs_ldap',
DOCKERHUB_REPO_NAME: '${DRONE_REPO_NAME}',
README_PATH: 'README.md',
SHORT_DESCRIPTION: 'Rootless Bitwarden_RS - Self-hosted password manager',
},

View File

@ -10,26 +10,18 @@ steps:
- name: binary
image: clux/muslrust:nightly-2019-12-19
commands:
- "[ -z \"${DRONE_TAG}\" ] && LDAP_VERSION=master || LDAP_VERSION=\"${DRONE_TAG%-*}\""
- mkdir -p source/
- rustup set profile minimal
- curl -sSL https://github.com/ViViDboarder/bitwarden_rs_ldap/archive/"$$LDAP_VERSION".tar.gz | tar xz -C source/ --strip-components=1
- grep -rlI 'Box<Error>' source/src/ | xargs sed -i 's/Box<Error>/Box<dyn Error>/g'
- cd source/ && cargo build -j 8 --release
- make build
environment:
DB: postgresql
DEBIAN_FRONTEND: noninteractive
LANG: C.UTF-8
TZ: UTC
BUILD_VERSION: ${DRONE_TAG%-*}
- name: dryrun
image: plugins/docker:linux-amd64
image: plugins/docker
settings:
dockerfile: Dockerfile.amd64
dockerfile: Dockerfile
dry_run: true
password:
from_secret: docker_password
repo: xoxys/bitwardenrs_ldap
repo: xoxys/${DRONE_REPO_NAME}
username:
from_secret: docker_username
when:
@ -37,14 +29,14 @@ steps:
- refs/pull/**
- name: publish
image: plugins/docker:linux-amd64
image: plugins/docker
settings:
auto_tag: true
auto_tag_suffix: amd64
dockerfile: Dockerfile.amd64
dockerfile: Dockerfile
password:
from_secret: docker_password
repo: xoxys/bitwardenrs_ldap
repo: xoxys/${DRONE_REPO_NAME}
username:
from_secret: docker_username
when:
@ -97,7 +89,7 @@ steps:
environment:
DOCKERHUB_PASSWORD:
from_secret: docker_password
DOCKERHUB_REPO_NAME: bitwardenrs_ldap
DOCKERHUB_REPO_NAME: ${DRONE_REPO_NAME}
DOCKERHUB_REPO_PREFIX: xoxys
DOCKERHUB_USERNAME:
from_secret: docker_username
@ -137,6 +129,6 @@ depends_on:
---
kind: signature
hmac: 25ce75557a40f6bc5b28e6cd1bfd8be018ccd81b72e9012da9bb04e7325f9330
hmac: 102f01aa01fda11f602b3287bcffaff10091321eb5f3ff83fe665090bd504297
...

27
Dockerfile Normal file
View File

@ -0,0 +1,27 @@
FROM xoxys/alpine
LABEL maintainer="Robert Kaussow <mail@geeklabor.de>" \
org.label-schema.name="bitwardenrs_ldap" \
org.label-schema.vcs-url="https://gitea.rknet.org/docker/bitwardenrs_ldap" \
org.label-schema.vendor="Robert Kaussow" \
org.label-schema.schema-version="1.0"
ADD overlay/ /
RUN apk --update add ca-certificates && \
mkdir -p /app && \
rm -rf /var/cache/apk/* && \
rm -rf /tmp/* && \
chown -R app:app /app
ADD src/target/x86_64-unknown-linux-musl/release/bitwarden_rs_ldap /app
VOLUME /app/data
USER app
STOPSIGNAL SIGTERM
ENTRYPOINT ["/usr/local/bin/entrypoint"]
WORKDIR /app
CMD []

View File

@ -1,36 +0,0 @@
FROM alpine:3.11
LABEL maintainer="Robert Kaussow <mail@geeklabor.de>" \
org.label-schema.name="bitwardenrs_ldap" \
org.label-schema.version="1.2" \
org.label-schema.vendor="Robert Kaussow" \
org.label-schema.schema-version="1.0"
RUN addgroup -g 101 -S app && \
adduser -S -D -H -u 101 -h /app -s /sbin/nologin -G app -g app app && \
apk --update add --virtual .build-deps tar curl && \
apk --update add ca-certificates && \
curl -SsL -o /usr/local/bin/gomplate https://github.com/hairyhenderson/gomplate/releases/download/v3.5.0/gomplate_linux-amd64-slim && \
curl -SsL -o /usr/local/bin/url-parser https://github.com/xoxys/url-parser/releases/download/v0.1.0/url-parser-0.1.0-linux-amd64 && \
curl -SsL -o /usr/local/bin/wait-for https://raw.githubusercontent.com/xoxys/wait-for/master/wait-for && \
chmod 755 /usr/local/bin/gomplate && \
chmod 755 /usr/local/bin/url-parser && \
chmod 755 /usr/local/bin/wait-for && \
apk del .build-deps && \
rm -rf /var/cache/apk/* && \
rm -rf /tmp/* && \
mkdir -p /app && \
chown -R app:app /app
ADD overlay/ /
ADD source/target/x86_64-unknown-linux-musl/release/bitwarden_rs_ldap /app
VOLUME /app/data
USER app
STOPSIGNAL SIGTERM
ENTRYPOINT ["/usr/local/bin/entrypoint"]
WORKDIR /app
CMD []

26
Makefile Normal file
View File

@ -0,0 +1,26 @@
export BUILD_VERSION ?= master
export DEBIAN_FRONTEND ?= noninteractive
export LANG ?= C.UTF-8
export TZ ?= UTC
SRC := src
.PHONY: all
all: build
.PHONY: build
build: build-src build-bin
.PHONY: build-src
build-src:
mkdir -p $(SRC); \
curl -sSL "https://github.com/ViViDboarder/bitwarden_rs_ldap/archive/$${BUILD_VERSION}.tar.gz" | tar xz -C $(SRC) --strip-components=1
.PHONY: build-bin
build-bin:
rustup set profile minimal && \
cd $(SRC) && \
cargo build -j 8 --release
.PHONY: clean
clean:
rm -rf $(SRC)

View File

@ -1,4 +1,4 @@
# [bitwarden_rs_ldap](https://gitea.rknet.org/docker/bitwarden_rs_ldap)
# [bitwardenrs_ldap](https://gitea.rknet.org/docker/bitwarden_rs_ldap)
[![Build Status](https://img.shields.io/drone/build/docker/bitwarden_rs_ldap?logo=drone&server=https%3A%2F%2Fdrone.rknet.org)](https://drone.rknet.org/docker/bitwarden_rs_ldap)
[![Docker Hub](https://img.shields.io/badge/docker-latest-blue.svg?logo=docker&logoColor=white)](https://hub.docker.com/r/xoxys/bitwardenrs_ldap)