ntfy : build images
This commit is contained in:
parent
8ad3710f2e
commit
d8a038ea15
|
@ -37,6 +37,15 @@ trigger_matrix:
|
|||
- changes:
|
||||
- podman-matrix/*
|
||||
|
||||
trigger_ntfy:
|
||||
stage: triggers
|
||||
trigger:
|
||||
include: podman-ntfy/.gitlab-ci.yml
|
||||
strategy: depend
|
||||
rules:
|
||||
- changes:
|
||||
- podman-ntfy/*
|
||||
|
||||
trigger_peerjs:
|
||||
stage: triggers
|
||||
trigger:
|
||||
|
|
12
podman-ntfy/.gitlab-ci.yml
Normal file
12
podman-ntfy/.gitlab-ci.yml
Normal file
|
@ -0,0 +1,12 @@
|
|||
# Si besoin d'executer le before_script manuellement :
|
||||
# sed -n 's/^ - \(.*\)$/\1/p' .gitlab-ci.yml | bash
|
||||
ntfy:
|
||||
stage: test
|
||||
script:
|
||||
- cd podman-ntfy
|
||||
- ./ci_build-images.sh
|
||||
tags:
|
||||
- garbaye
|
||||
- compute
|
||||
- podman
|
||||
- x86_64
|
20
podman-ntfy/ci_build-images.sh
Executable file
20
podman-ntfy/ci_build-images.sh
Executable file
|
@ -0,0 +1,20 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
ABSDIR="$( dirname "$(readlink -f -- "$0")" )"
|
||||
source ${ABSDIR}/../functions.sh
|
||||
source ${ABSDIR}/vars.sh
|
||||
|
||||
ensure_pwd_is_scriptdir
|
||||
ensure_not_root
|
||||
|
||||
if ! podman image exists ${ntfy_image}:${ntfy_version}; then
|
||||
TMPDIR=${HOME} podman build -t "${ntfy_image}:${ntfy_version}" docker/ --build-arg NTFY_VERSION=${ntfy_version}
|
||||
podman image prune -a -f --filter dangling=true
|
||||
podman image prune -a -f --filter intermediate=true
|
||||
podman image rm -f $(podman images -a -q -- docker.io/library/golang)
|
||||
podman image rm -f $(podman images -a -q -- docker.io/library/alpine)
|
||||
else
|
||||
echo "Image ${ntfy_image}:${ntfy_version} already built"
|
||||
fi
|
||||
|
||||
oci_push_to_registry ${ntfy_image}:${ntfy_version}
|
37
podman-ntfy/docker/Dockerfile
Normal file
37
podman-ntfy/docker/Dockerfile
Normal file
|
@ -0,0 +1,37 @@
|
|||
#Build stage
|
||||
FROM golang:1.19-alpine3.16 AS build-env
|
||||
|
||||
ARG NTFY_VERSION
|
||||
|
||||
#Build deps
|
||||
RUN apk --no-cache add build-base git nodejs npm upx py3-pip
|
||||
|
||||
#Install gorealeaser
|
||||
RUN go install github.com/goreleaser/goreleaser@latest
|
||||
|
||||
#Setup repo
|
||||
RUN git clone --depth=1 -b "${NTFY_VERSION}" https://github.com/binwiederhier/ntfy.git
|
||||
|
||||
#Build
|
||||
RUN cd ntfy && make web && make docs && make cli-linux-amd64
|
||||
|
||||
FROM alpine:3.16
|
||||
LABEL maintainer="contact@garbaye.fr"
|
||||
|
||||
EXPOSE 80/tcp
|
||||
|
||||
RUN adduser \
|
||||
-S -H -D \
|
||||
ntfy && \
|
||||
mkdir /etc/ntfy && \
|
||||
chown ntfy:nogroup /etc/ntfy && \
|
||||
mkdir /var/cache/ntfy && \
|
||||
chown ntfy:nogroup /var/cache/ntfy
|
||||
|
||||
USER ntfy
|
||||
|
||||
ENTRYPOINT ["ntfy"]
|
||||
|
||||
COPY --from=build-env /go/ntfy/dist/ntfy_linux_amd64_linux_amd64_v1/ntfy /usr/bin/ntfy
|
||||
|
||||
# podman run --rm -p 3333:3333 -it localhost/ntfy:v1.29.0 serve --listen-http :3333
|
13
podman-ntfy/vars.sh
Normal file
13
podman-ntfy/vars.sh
Normal file
|
@ -0,0 +1,13 @@
|
|||
#!/usr/bin/env bash
|
||||
## vars
|
||||
ntfy_image="git.garbaye.fr/garbaye/ntfy"
|
||||
ntfy_version='v1.29.0'
|
||||
## default vars : override with ENV var
|
||||
## mandatory ENV vars
|
||||
## internal vars : do not touch
|
||||
project_name=${PWD##*/}
|
||||
container_name="${project_name}"
|
||||
service_name="container-${container_name}.service"
|
||||
cachevolume='podman-ntfy_cache'
|
||||
container_name='ntfy'
|
||||
|
Loading…
Reference in a new issue