Skip to content

Instantly share code, notes, and snippets.

@daxim
Created February 2, 2023 17:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save daxim/d4f4ee51e77935bc77e0fd2d235e7b1f to your computer and use it in GitHub Desktop.
Save daxim/d4f4ee51e77935bc77e0fd2d235e7b1f to your computer and use it in GitHub Desktop.
FROM opensuse/tumbleweed
RUN zypper ref && \
zypper in --no-recommends -y entr make perl-App-cpanminus && \
zypper cc -a && \
cpanm -n MHonArc::UTF8 && \
rm -rf /root/.cpanm
ARG MAILDIR
ARG OUTDIR
RUN mkdir -p ${MAILDIR} ${OUTDIR}
ENV MAILDIR ${MAILDIR}
ENV OUTDIR ${OUTDIR}
CMD while true; do \
ls -d ${MAILDIR}/* | entr -n -d \
mhonarc -outdir ${OUTDIR} -add ${MAILDIR}; \
done
APP_NAME ?= luga-mail-web-archive
# location of input files in container
MAILDIR ?= /var/lib/mhonarc
# location of output files in container
OUTDIR ?= /srv/www/htdocs
image:
podman images -n | grep ${APP_NAME} || \
podman build \
--build-arg MAILDIR=${MAILDIR} \
--build-arg OUTDIR=${OUTDIR} \
-t ${APP_NAME} .
${APP_NAME}.tar: | image
podman save --format oci-archive --output $@ ${APP_NAME}
# ----
# development stuff follows
inspect-image:
dive --source podman ${APP_NAME}
run-container:
podman run -v ./mhonarc:${MAILDIR} -v ./htdocs:${OUTDIR} -d ${APP_NAME}
stop-latest-container:
podman container stop -t 1 -l
remove-latest-container:
podman container rm -l
debug-latest-container:
podman exec -it -l bash
clean: | remove-image remove-archive
remove-image:
podman rmi -f ${APP_NAME}
remove-archive:
rm -f ${APP_NAME}.tar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment