diff --git a/Dockerfile b/Dockerfile index 47f17ad..77c54e6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,28 @@ FROM docker.io/library/alpine:3.18.5 -RUN echo "http://dl-3.alpinelinux.org/alpine/edge/testing/" >> /etc/apk/repositories -RUN apk upgrade -RUN apk add --update perl perl-lockfile-simple perl-dbi perl-dbd-pg perl-dbd-mysql fetchmail +# The file /etc/apk/repositories contains a list of the apk repositories. By +# default contains this file a list of the stable repositories pointing to the +# alpine version. +# +# Some perl packages are not part of the stable repositories. For this reason +# are the repositories switched to edge to access directly the latest versions +# of this apk packages. +# +# Using stable and edge at the same time is not allowed. For more information, +# take a look into the documentation of the edge repository. +# +# https://wiki.alpinelinux.org/wiki/Repositories#Edge +RUN echo "https://dl-cdn.alpinelinux.org/alpine/edge/main" > /etc/apk/repositories +RUN echo "https://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories + +# Install packages +RUN apk upgrade && \ + apk add --update perl perl-lockfile-simple perl-dbi perl-dbd-pg perl-dbd-mysql fetchmail + RUN mkdir --parents /run/fetchmail COPY --chown=fetchmail:fetchmail fetchmail.pl /usr/local/bin/fetchmail.pl USER fetchmail -ENTRYPOINT [ "/usr/bin/perl" ] CMD [ "/usr/local/bin/fetchmail.pl" ] \ No newline at end of file diff --git a/Makefile b/Makefile index 0bd569b..e4f1bcd 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,6 @@ -# CONTAINER_RUNTIME -# The CONTAINER_RUNTIME variable will be used to specified the path to a -# container runtime. This is needed to start and run a container image. -CONTAINER_RUNTIME?=$(shell which podman) +# PODMAN_BIN's and tools +PODMAN_BIN?=$(shell which podman) +SKOPEO_BIN?=$(shell which skopeo) # FETCHMAIL_IMAGE_REGISTRY_NAME # Defines the name of the new container to be built using several variables. @@ -12,33 +11,39 @@ FETCHMAIL_IMAGE_NAMESPACE?=${FETCHMAIL_IMAGE_REGISTRY_USER} FETCHMAIL_IMAGE_NAME:=postfixadmin-fetchmail FETCHMAIL_IMAGE_VERSION?=latest FETCHMAIL_IMAGE_FULLY_QUALIFIED=${FETCHMAIL_IMAGE_REGISTRY_NAME}/${FETCHMAIL_IMAGE_NAMESPACE}/${FETCHMAIL_IMAGE_NAME}:${FETCHMAIL_IMAGE_VERSION} -FETCHMAIL_IMAGE_UNQUALIFIED=${FETCHMAIL_IMAGE_NAMESPACE}/${FETCHMAIL_IMAGE_NAME}:${FETCHMAIL_IMAGE_VERSION} + # BUILD CONTAINER IMAGE # ============================================================================== PHONY:=container-image/build container-image/build: - ${CONTAINER_RUNTIME} build \ + ${PODMAN_BIN} build \ --file Dockerfile \ --no-cache \ --pull \ --tag ${FETCHMAIL_IMAGE_FULLY_QUALIFIED} \ - --tag ${FETCHMAIL_IMAGE_UNQUALIFIED} \ . # DELETE CONTAINER IMAGE # ============================================================================== PHONY:=container-image/delete container-image/delete: - - ${CONTAINER_RUNTIME} image rm ${FETCHMAIL_IMAGE_FULLY_QUALIFIED} ${FETCHMAIL_IMAGE_UNQUALIFIED} - - ${CONTAINER_RUNTIME} image rm ${BASE_IMAGE_FULL} + - ${PODMAN_BIN} image rm ${FETCHMAIL_IMAGE_FULLY_QUALIFIED} + - ${PODMAN_BIN} image rm ${BASE_IMAGE_FULL} # PUSH CONTAINER IMAGE # ============================================================================== PHONY+=container-image/push container-image/push: - echo ${FETCHMAIL_IMAGE_REGISTRY_PASSWORD} | ${CONTAINER_RUNTIME} login ${FETCHMAIL_IMAGE_REGISTRY_NAME} --username ${FETCHMAIL_IMAGE_REGISTRY_USER} --password-stdin - ${CONTAINER_RUNTIME} push ${FETCHMAIL_IMAGE_FULLY_QUALIFIED} + echo ${FETCHMAIL_IMAGE_REGISTRY_PASSWORD} | ${PODMAN_BIN} login ${FETCHMAIL_IMAGE_REGISTRY_NAME} --username ${FETCHMAIL_IMAGE_REGISTRY_USER} --password-stdin + ${PODMAN_BIN} push ${FETCHMAIL_IMAGE_FULLY_QUALIFIED} + ${PODMAN_BIN} logout ${FETCHMAIL_IMAGE_FULLY_QUALIFIED} + +# PUSH CONTAINER IMAGE TO DOCKER +# ============================================================================== +PHONY+=container-image/push-to-docker-daemon +container-image/push-to-docker-daemon: + ${PODMAN_BIN} push ${FETCHMAIL_IMAGE_FULLY_QUALIFIED} docker-daemon:${FETCHMAIL_IMAGE_FULLY_QUALIFIED} # PHONY # ==============================================================================