Skip to content

Commit

Permalink
Upd: Fix integration tests with the latest refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
bokysan committed Apr 13, 2022
1 parent a6d10e6 commit 3385de7
Show file tree
Hide file tree
Showing 11 changed files with 22 additions and 29 deletions.
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ ARG BASE_IMAGE=alpine:latest
FROM ${BASE_IMAGE} AS build-scripts
COPY ./build-scripts ./build-scripts

FROM ${BASE_IMAGE} AS base
# ============================ INSTALL BASIC SERVICES ============================
FROM ${BASE_IMAGE} AS base

# Install supervisor, postfix
# Install postfix first to get the first account (101)
Expand All @@ -20,8 +20,8 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=bind,from=build-scripts,source=/build-scripts,target=/build-scripts \
sh /build-scripts/postfix-install.sh

FROM base AS sasl
# ============================ BUILD SASL XOAUTH2 ============================
FROM base AS sasl

ARG SASL_XOAUTH2_REPO_URL=https://github.com/tarickb/sasl-xoauth2.git
ARG SASL_XOAUTH2_GIT_REF=release-0.12
Expand All @@ -36,6 +36,7 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=bind,from=build-scripts,source=/build-scripts,target=/build-scripts \
sh /build-scripts/sasl-build.sh

# ============================ Prepare main image ============================
FROM sasl
LABEL maintainer="Bojan Cekrlic - https://github.com/bokysan/docker-postfix/"

Expand Down
28 changes: 17 additions & 11 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,16 @@ export DOCKER_BUILDKIT=1
export DOCKER_CLI_EXPERIMENTAL=enabled
export BUILDKIT_PROGRESS=plain

declare cache_dir="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )/cache"
declare cache_dir
declare arg_list
declare PLATFORMS

if [[ "$CI" == "true" ]]; then
cache_form="/tmp/.buildx-cache/alpine"
cache_to="/tmp/.buildx-cache-new/alpine"
else
cache_from="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )/cache"
cache_to="${cache_from}"
fi

if ! docker buildx inspect multiarch > /dev/null; then
docker buildx create --name multiarch
Expand All @@ -22,17 +29,16 @@ if [[ "$*" == *--push* ]]; then
fi
fi

arg_list=" --cache-to type=local,dest=${cache_dir}"
if [[ -f "${cache_dir}/index.json" ]]; then
arg_list="$arg_list --cache-from type=local,src=${cache_dir}"
arg_list=" --cache-to type=local,dest=${cache_to}"
if [[ -f "${cache_form}/index.json" ]]; then
arg_list="$arg_list --cache-from type=local,src=${cache_form}"
else
mkdir -p "${cache_dir}"
mkdir -p "${cache_form}"
fi

#if [[ -z "$PLATFORMS" ]]; then
# arg_list="$arg_list --platforms linux/amd64,linux/arm64,linux/arm/v7"
#fi

if [[ -z "$PLATFORMS" ]]; then
PLATFORMS="linux/amd64,linux/arm64,linux/arm/v7"
fi

docker buildx build ${arg_list} --platform $PLATFORMS . $*
docker buildx build ${arg_list} . $*

2 changes: 2 additions & 0 deletions integration-tests.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/env bash
set -e

./build.sh --load --tag boky/postfix
cd integration-tests

FIND="$(which find)"
Expand Down
2 changes: 0 additions & 2 deletions integration-tests/basic-test/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ services:
postfix_test_587:
hostname: "postfix"
image: "boky/postfix"
build:
context: ../..
restart: always
healthcheck:
test: [ "CMD", "sh", "-c", "netstat -an | fgrep 587 | fgrep -q LISTEN" ]
Expand Down
2 changes: 0 additions & 2 deletions integration-tests/deprecated/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ services:
postfix_test_587:
hostname: "postfix"
image: "boky/postfix"
build:
context: ../..
restart: always
healthcheck:
test: [ "CMD", "sh", "-c", "netstat -an | fgrep 587 | fgrep -q LISTEN" ]
Expand Down
2 changes: 0 additions & 2 deletions integration-tests/generate-dkim-keys/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ services:
postfix_test_587:
hostname: "postfix"
image: "boky/postfix"
build:
context: ../..
restart: always
healthcheck:
test: [ "CMD", "sh", "-c", "netstat -an | fgrep 587 | fgrep -q LISTEN" ]
Expand Down
2 changes: 0 additions & 2 deletions integration-tests/no-dkim-test/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ services:
postfix_test_587:
hostname: "postfix"
image: "boky/postfix"
build:
context: ../..
restart: always
healthcheck:
test: [ "CMD", "sh", "-c", "netstat -an | fgrep 587 | fgrep -q LISTEN" ]
Expand Down
2 changes: 0 additions & 2 deletions integration-tests/non-allowed-networks/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ services:
postfix_test_587:
hostname: "postfix"
image: "boky/postfix"
build:
context: ../..
restart: always
healthcheck:
test: [ "CMD", "sh", "-c", "netstat -an | fgrep 587 | fgrep -q LISTEN" ]
Expand Down
2 changes: 0 additions & 2 deletions integration-tests/relay-password/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ services:
postfix_test_587:
hostname: "postfix"
image: "boky/postfix"
build:
context: ../..
restart: always
healthcheck:
test: [ "CMD", "sh", "-c", "netstat -an | fgrep 587 | fgrep -q LISTEN" ]
Expand Down
2 changes: 0 additions & 2 deletions integration-tests/xoauth2-error/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ services:
postfix_test_587:
hostname: "postfix"
image: "boky/postfix"
build:
context: ../..
restart: always
healthcheck:
test: [ "CMD", "sh", "-c", "netstat -an | fgrep 587 | fgrep -q LISTEN" ]
Expand Down
2 changes: 0 additions & 2 deletions integration-tests/xoauth2/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ services:
postfix_test_587:
hostname: "postfix"
image: "boky/postfix"
build:
context: ../..
restart: always
healthcheck:
test: [ "CMD", "sh", "-c", "netstat -an | fgrep 587 | fgrep -q LISTEN" ]
Expand Down

0 comments on commit 3385de7

Please sign in to comment.