diff --git a/.dockerignore b/.dockerignore index d55305a1..643e6dbd 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,4 +1,4 @@ * -!vieter/ +!src/ !Makefile diff --git a/.woodpecker/.publish.yml b/.woodpecker/.publish.yml new file mode 100644 index 00000000..4456649a --- /dev/null +++ b/.woodpecker/.publish.yml @@ -0,0 +1,22 @@ +pipeline: + dev: + image: plugins/docker + secrets: [ docker_username, docker_password ] + settings: + repo: chewingbever/vieter + tag: dev + when: + event: push + branch: dev + + release: + image: plugins/docker + secrets: [ docker_username, docker_password ] + settings: + repo: chewingbever/vieter + tag: + - latest + - $CI_COMMIT_TAG + when: + event: tag + branch: main diff --git a/Dockerfile b/Dockerfile index e8b2484d..556ca58a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,20 +1,21 @@ -FROM archlinux:latest AS builder +FROM chewingbever/vlang:latest AS builder -WORKDIR /src -COPY vieter ./vieter +WORKDIR /app + +# Copy over source code & build production binary +COPY src ./src COPY Makefile ./ - -RUN pacman \ - -Syu --noconfirm --needed \ - gcc git openssl make && \ - make customv && \ - jjr-v/v -prod vieter +RUN make prod -FROM archlinux:latest +FROM alpine:3.15 ENV REPO_DIR=/data -COPY --from=builder /src/vieter/vieter /usr/local/bin/ +RUN apk update && \ + apk add --no-cache \ + libarchive + +COPY --from=builder /app/pvieter /usr/local/bin/vieter ENTRYPOINT [ "/usr/local/bin/vieter" ] diff --git a/src/main.v b/src/main.v index e779c8ff..af6b06c5 100644 --- a/src/main.v +++ b/src/main.v @@ -54,7 +54,7 @@ fn reader_to_file(mut reader io.BufferedReader, length int, path string) ? { } } -fn main2() { +fn main() { // Configure logger log_level_str := os.getenv_opt('LOG_LEVEL') or { 'WARN' } log_level := log.level_from_tag(log_level_str) or { @@ -102,11 +102,11 @@ fn main2() { }, port) } -fn main() { - // archive.list_filenames() - info := archive.get_pkg_info('test/jjr-joplin-desktop-2.6.10-4-x86_64.pkg.tar.zst') or { - eprintln(err.msg) - return - } - println(info) -} +// fn main() { +// // archive.list_filenames() +// info := archive.get_pkg_info('test/jjr-joplin-desktop-2.6.10-4-x86_64.pkg.tar.zst') or { +// eprintln(err.msg) +// return +// } +// println(info) +// }