mirror of
https://github.com/docker-mailserver/docker-mailserver.git
synced 2024-01-19 02:48:50 +00:00
build: cleaned up Makefile (#2833)
This commit is contained in:
parent
ac795a5976
commit
284c44faa9
43
.gitignore
vendored
43
.gitignore
vendored
|
@ -2,37 +2,36 @@
|
||||||
### General ###################################
|
### General ###################################
|
||||||
#################################################
|
#################################################
|
||||||
|
|
||||||
.DS_Store
|
|
||||||
.env
|
.env
|
||||||
config/opendkim/
|
docs/site/
|
||||||
|
|
||||||
|
config.bak
|
||||||
|
testconfig.bak
|
||||||
|
|
||||||
#################################################
|
#################################################
|
||||||
### IDEs ######################################
|
### IDEs ######################################
|
||||||
#################################################
|
#################################################
|
||||||
|
|
||||||
.idea
|
.idea/
|
||||||
.vscode
|
.vscode/
|
||||||
|
|
||||||
|
|
||||||
#################################################
|
|
||||||
### Linting Tools #############################
|
|
||||||
#################################################
|
|
||||||
|
|
||||||
tools/
|
|
||||||
|
|
||||||
#################################################
|
#################################################
|
||||||
### Tests #####################################
|
### Tests #####################################
|
||||||
#################################################
|
#################################################
|
||||||
|
|
||||||
test/config/empty/
|
test/onedir/
|
||||||
test/config/postfix-accounts.cf
|
test/duplicate_configs/
|
||||||
test/config/dovecot-masters.cf
|
test/alias/
|
||||||
test/config/letsencrypt/mail.my-domain.com/combined.pem
|
test/quota/
|
||||||
test/config/dovecot-lmtp/userdb
|
test/relay/
|
||||||
test/config/key*
|
test/config/key*
|
||||||
|
test/config/empty/
|
||||||
|
test/config/dovecot-masters.cf
|
||||||
|
test/config/dovecot-lmtp/userdb
|
||||||
test/config/opendkim/keys/domain.tld/
|
test/config/opendkim/keys/domain.tld/
|
||||||
test/config/opendkim/keys/example.com/
|
test/config/opendkim/keys/example.com/
|
||||||
test/config/opendkim/keys/localdomain2.com/
|
test/config/opendkim/keys/localdomain2.com/
|
||||||
|
test/config/postfix-accounts.cf
|
||||||
test/config/postfix-aliases.cf
|
test/config/postfix-aliases.cf
|
||||||
test/config/postfix-receive-access.cf
|
test/config/postfix-receive-access.cf
|
||||||
test/config/postfix-receive-access.cfe
|
test/config/postfix-receive-access.cfe
|
||||||
|
@ -40,15 +39,3 @@ test/config/postfix-send-access.cf
|
||||||
test/config/postfix-send-access.cfe
|
test/config/postfix-send-access.cfe
|
||||||
test/config/relay-hosts/chksum
|
test/config/relay-hosts/chksum
|
||||||
test/config/relay-hosts/postfix-aliases.cf
|
test/config/relay-hosts/postfix-aliases.cf
|
||||||
test/config/without-virtual/
|
|
||||||
test/config/with-domain/
|
|
||||||
test/onedir
|
|
||||||
test/duplicate_configs
|
|
||||||
test/alias
|
|
||||||
test/quota
|
|
||||||
test/relay
|
|
||||||
|
|
||||||
config.bak
|
|
||||||
testconfig.bak
|
|
||||||
|
|
||||||
docs/site
|
|
||||||
|
|
|
@ -10,6 +10,10 @@ All notable changes to this project will be documented in this file. The format
|
||||||
|
|
||||||
- **scripts**: fail2ban - enable network bans ([#2818](https://github.com/docker-mailserver/docker-mailserver/pull/2818))
|
- **scripts**: fail2ban - enable network bans ([#2818](https://github.com/docker-mailserver/docker-mailserver/pull/2818))
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- **build** cleaned up `Makefile` and its targets ([#2833](https://github.com/docker-mailserver/docker-mailserver/pull/2833))
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- **scripts**: Run `user-patches.sh` right before starting daemons ([#2817](https://github.com/docker-mailserver/docker-mailserver/pull/2817))
|
- **scripts**: Run `user-patches.sh` right before starting daemons ([#2817](https://github.com/docker-mailserver/docker-mailserver/pull/2817))
|
||||||
|
|
33
Makefile
33
Makefile
|
@ -1,20 +1,26 @@
|
||||||
SHELL = /bin/bash
|
SHELL := /bin/bash
|
||||||
|
.SHELLFLAGS += -e -u -o pipefail
|
||||||
|
|
||||||
export NAME ?= mailserver-testing:ci
|
export IMAGE_NAME := mailserver-testing:ci
|
||||||
export IMAGE_NAME := $(NAME)
|
export NAME ?= $(IMAGE_NAME)
|
||||||
|
|
||||||
# -----------------------------------------------
|
# -----------------------------------------------
|
||||||
# --- Generic Build Targets ---------------------
|
# --- Generic Targets ---------------------------
|
||||||
# -----------------------------------------------
|
# -----------------------------------------------
|
||||||
|
|
||||||
all: lint build backup generate-accounts tests clean
|
all: lint build backup generate-accounts tests clean
|
||||||
|
|
||||||
build:
|
build:
|
||||||
@ DOCKER_BUILDKIT=1 docker build --tag $(NAME) \
|
@ DOCKER_BUILDKIT=1 docker build \
|
||||||
|
--tag $(IMAGE_NAME) \
|
||||||
--build-arg VCS_VERSION=$(shell git rev-parse --short HEAD) \
|
--build-arg VCS_VERSION=$(shell git rev-parse --short HEAD) \
|
||||||
--build-arg VCS_REVISION=$(shell cat VERSION) \
|
--build-arg VCS_REVISION=$(shell cat VERSION) \
|
||||||
.
|
.
|
||||||
|
|
||||||
|
generate-accounts:
|
||||||
|
@ cp test/config/templates/postfix-accounts.cf test/config/postfix-accounts.cf
|
||||||
|
@ cp test/config/templates/dovecot-masters.cf test/config/dovecot-masters.cf
|
||||||
|
|
||||||
backup:
|
backup:
|
||||||
# if backup directory exist, clean hasn't been called, therefore
|
# if backup directory exist, clean hasn't been called, therefore
|
||||||
# we shouldn't overwrite it. It still contains the original content.
|
# we shouldn't overwrite it. It still contains the original content.
|
||||||
|
@ -23,24 +29,13 @@ backup:
|
||||||
clean:
|
clean:
|
||||||
# remove test containers and restore test/config directory
|
# remove test containers and restore test/config directory
|
||||||
-@ [[ -d testconfig.bak ]] && { sudo rm -rf test/config ; mv testconfig.bak test/config ; } || :
|
-@ [[ -d testconfig.bak ]] && { sudo rm -rf test/config ; mv testconfig.bak test/config ; } || :
|
||||||
-@ for container in $$(docker ps -a --filter name='^/mail$$|^ldap_for_mail$$|^mail_override_hostname$$|^mail_non_subdomain_hostname$$|^open-dkim$$|^hadolint$$|^eclint$$|^shellcheck$$|mail_changedetector.*' | sed 1d | cut -f 1-1 -d ' '); do docker rm -f $$container; done
|
-@ for CONTAINER in $$(docker ps -a --filter name='^dms-test-.*|^mail_.*|^hadolint$$|^eclint$$|^shellcheck$$' | sed 1d | cut -f 1-1 -d ' '); do docker rm -f $${CONTAINER}; done
|
||||||
-@ sudo rm -rf test/onedir test/alias test/quota test/relay test/config/dovecot-lmtp/userdb test/config/key* test/config/opendkim/keys/domain.tld/ test/config/opendkim/keys/example.com/ test/config/opendkim/keys/localdomain2.com/ test/config/postfix-aliases.cf test/config/postfix-receive-access.cf test/config/postfix-receive-access.cfe test/config/dovecot-quotas.cf test/config/postfix-send-access.cf test/config/postfix-send-access.cfe test/config/relay-hosts/chksum test/config/relay-hosts/postfix-aliases.cf test/config/dhparams.pem test/config/dovecot-lmtp/dh.pem test/config/relay-hosts/dovecot-quotas.cf test/config/user-patches.sh test/alias/config/postfix-virtual.cf test/quota/config/dovecot-quotas.cf test/quota/config/postfix-accounts.cf test/relay/config/postfix-relaymap.cf test/relay/config/postfix-sasl-password.cf test/duplicate_configs/
|
-@ while read -r LINE; do [[ $${LINE} =~ test/.+ ]] && sudo rm -rf $${LINE}; done < .gitignore
|
||||||
|
|
||||||
# -----------------------------------------------
|
# -----------------------------------------------
|
||||||
# --- Tests -------------------------------------
|
# --- Tests & Lints ----------------------------
|
||||||
# -----------------------------------------------
|
# -----------------------------------------------
|
||||||
|
|
||||||
generate-accounts:
|
|
||||||
# Normal mail accounts
|
|
||||||
@ docker run --rm -e MAIL_USER=user1@localhost.localdomain -e MAIL_PASS=mypassword -t $(NAME) /bin/sh -c 'echo "$$MAIL_USER|$$(doveadm pw -s SHA512-CRYPT -u $$MAIL_USER -p $$MAIL_PASS)"' > test/config/postfix-accounts.cf
|
|
||||||
@ docker run --rm -e MAIL_USER=user2@otherdomain.tld -e MAIL_PASS=mypassword -t $(NAME) /bin/sh -c 'echo "$$MAIL_USER|$$(doveadm pw -s SHA512-CRYPT -u $$MAIL_USER -p $$MAIL_PASS)"' >> test/config/postfix-accounts.cf
|
|
||||||
@ docker run --rm -e MAIL_USER=user3@localhost.localdomain -e MAIL_PASS=mypassword -t $(NAME) /bin/sh -c 'echo "$$MAIL_USER|$$(doveadm pw -s SHA512-CRYPT -u $$MAIL_USER -p $$MAIL_PASS)|userdb_mail=mbox:~/mail:INBOX=~/inbox"' >> test/config/postfix-accounts.cf
|
|
||||||
@ echo "# this is a test comment, please don't delete me :'(" >> test/config/postfix-accounts.cf
|
|
||||||
@ echo " # this is also a test comment, :O" >> test/config/postfix-accounts.cf
|
|
||||||
|
|
||||||
# Dovecot master accounts
|
|
||||||
@ docker run --rm -e MASTER_USER=masterusername -e MASTER_PASS=masterpassword -t $(NAME) /bin/sh -c 'echo "$$MASTER_USER|$$(doveadm pw -s SHA512-CRYPT -u $$MASTER_USER -p $$MASTER_PASS)"' > test/config/dovecot-masters.cf
|
|
||||||
|
|
||||||
tests:
|
tests:
|
||||||
@ ./test/bats/bin/bats --timing test/*.bats
|
@ ./test/bats/bin/bats --timing test/*.bats
|
||||||
|
|
||||||
|
|
1
test/config/templates/dovecot-masters.cf
Normal file
1
test/config/templates/dovecot-masters.cf
Normal file
|
@ -0,0 +1 @@
|
||||||
|
masterusername|{SHA512-CRYPT}$6$IOybywiyl1nuDno0$gRW625qH7ThmbRaByNVpuAGgDOkMd7tc3yuVmwVRuk7IXgiN8KDwcqtMcU0LyvS5RGAskbplavjPpCmFjbKEt1
|
5
test/config/templates/postfix-accounts.cf
Normal file
5
test/config/templates/postfix-accounts.cf
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
user1@localhost.localdomain|{SHA512-CRYPT}$6$DBEbjh4I9P7aROk8$XosqE.YI2Z4bUkWD1/bedrSNpw79nsO60yiAKk04jARhPVX5VD/SaVM5HWFDQyzftESVDjbVdhzn/d4TJxFwg0
|
||||||
|
user2@otherdomain.tld|{SHA512-CRYPT}$6$PQRkR3RRzpYP4WET$NKLJk3PkwTRRSxryqFhQloBR7qSAYjoQH/IbD1ZQKX2UJJ3jmdbOMQPfMRGXBZv3JGhDUPmAiWzoJL6/NJN5d/
|
||||||
|
user3@localhost.localdomain|{SHA512-CRYPT}$6$lZwv0IoijHyEjDtM$vGsAS7KM5O5Q1NdWjard1LbJyGiHcqHhKAXBKDIMudjB/CuVvOvXKVy2yKeeRvKxVtkCdYac738VQPL.kpSVB.|userdb_mail=mbox:~/mail:INBOX=~/inbox
|
||||||
|
# this is a test comment, please don't delete me :'(
|
||||||
|
# this is also a test comment, :O
|
Loading…
Reference in a new issue