Skip to content

Commit 380260b

Browse files
committed
ci: proxy config check
Signed-off-by: CrazyMax <[email protected]>
1 parent ac790be commit 380260b

File tree

2 files changed

+80
-0
lines changed

2 files changed

+80
-0
lines changed

.github/workflows/ci.yml

+71
Original file line numberDiff line numberDiff line change
@@ -1001,3 +1001,74 @@ jobs:
10011001
file: ./test/named-context.Dockerfile
10021002
build-contexts: |
10031003
alpine=docker-image://localhost:5000/my-base-image:latest
1004+
1005+
proxy-docker-config:
1006+
runs-on: ubuntu-latest
1007+
services:
1008+
squid-proxy:
1009+
image: ubuntu/squid:latest
1010+
ports:
1011+
- 3128:3128
1012+
steps:
1013+
-
1014+
name: Check proxy
1015+
run: |
1016+
netstat -aptn
1017+
curl --retry 5 --retry-all-errors --retry-delay 0 --connect-timeout 5 --proxy http://127.0.0.1:3128 -v --insecure --head https://www.google.com
1018+
-
1019+
name: Checkout
1020+
uses: actions/checkout@v3
1021+
-
1022+
name: Set proxy config
1023+
run: |
1024+
mkdir -p ~/.docker
1025+
echo '{"proxies":{"default":{"httpProxy":"http://127.0.0.1:3128","httpsProxy":"http://127.0.0.1:3128"}}}' > ~/.docker/config.json
1026+
-
1027+
name: Set up Docker Buildx
1028+
uses: docker/setup-buildx-action@v2
1029+
with:
1030+
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
1031+
driver-opts: |
1032+
image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }}
1033+
network=host
1034+
buildkitd-flags: --debug
1035+
-
1036+
name: Build
1037+
uses: ./
1038+
with:
1039+
context: ./test
1040+
file: ./test/proxy.Dockerfile
1041+
1042+
proxy-buildkitd:
1043+
runs-on: ubuntu-latest
1044+
services:
1045+
squid-proxy:
1046+
image: ubuntu/squid:latest
1047+
ports:
1048+
- 3128:3128
1049+
steps:
1050+
-
1051+
name: Check proxy
1052+
run: |
1053+
netstat -aptn
1054+
curl --retry 5 --retry-all-errors --retry-delay 0 --connect-timeout 5 --proxy http://127.0.0.1:3128 -v --insecure --head https://www.google.com
1055+
-
1056+
name: Checkout
1057+
uses: actions/checkout@v3
1058+
-
1059+
name: Set up Docker Buildx
1060+
uses: docker/setup-buildx-action@v2
1061+
with:
1062+
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
1063+
driver-opts: |
1064+
image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }}
1065+
network=host
1066+
env.http_proxy=http://127.0.0.1:3128
1067+
env.https_proxy=http://127.0.0.1:3128
1068+
buildkitd-flags: --debug
1069+
-
1070+
name: Build
1071+
uses: ./
1072+
with:
1073+
context: ./test
1074+
file: ./test/Dockerfile

test/proxy.Dockerfile

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# syntax=docker/dockerfile:1
2+
FROM alpine
3+
RUN apk add --no-cache curl net-tools
4+
ARG HTTP_PROXY
5+
ARG HTTPS_PROXY
6+
RUN printenv HTTP_PROXY
7+
RUN printenv HTTPS_PROXY
8+
RUN netstat -aptn
9+
RUN curl --retry 5 --retry-all-errors --retry-delay 0 --connect-timeout 5 --proxy $HTTP_PROXY -v --insecure --head https://www.google.com

0 commit comments

Comments
 (0)