Skip to content
This repository was archived by the owner on Jun 17, 2023. It is now read-only.

Commit 3eceb55

Browse files
Merge pull request #3 from sergeymakinen/feature/docker
Optimize Docker caching
2 parents 3223374 + 55d2b7e commit 3eceb55

File tree

3 files changed

+24
-12
lines changed

3 files changed

+24
-12
lines changed

.github/workflows/tests.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,26 +19,26 @@ jobs:
1919
- ubuntu-latest
2020
runs-on: ${{ matrix.os }}
2121
steps:
22-
- name: Install Go
23-
uses: actions/setup-go@v2
24-
with:
25-
go-version: ${{ matrix.go-version }}
2622
- name: Checkout code
2723
uses: actions/checkout@v2
28-
- name: Start strongswan containers
24+
- name: Start and wait for libreswan containers
2925
run: |
3026
for i in {1..10}; do
3127
echo $i:
32-
docker-compose -f testdata/docker/strongswan/docker-compose.yml exec -T moon /bin/sh -c 'ipsec statusall || true' | grep '64 bytes_i' && break || (docker-compose -f testdata/docker/strongswan/docker-compose.yml up -d --force-recreate && sleep 30)
28+
docker-compose -f testdata/docker/libreswan/docker-compose.yml exec -T moon /bin/sh -c 'ipsec status || true' | grep 'ESPin=84B' && break || (docker-compose -f testdata/docker/libreswan/docker-compose.yml up -d --force-recreate && sleep 30)
3329
done
34-
docker-compose -f testdata/docker/strongswan/docker-compose.yml exec -T moon /bin/sh -c 'ipsec statusall || true'
35-
- name: Start libreswan containers
30+
docker-compose -f testdata/docker/libreswan/docker-compose.yml exec -T moon /bin/sh -c 'ipsec status || true'
31+
- name: Start and wait for strongswan containers
3632
run: |
3733
for i in {1..10}; do
3834
echo $i:
39-
docker-compose -f testdata/docker/libreswan/docker-compose.yml exec -T moon /bin/sh -c 'ipsec status || true' | grep 'ESPin=84B' && break || (docker-compose -f testdata/docker/libreswan/docker-compose.yml up -d --force-recreate && sleep 30)
35+
docker-compose -f testdata/docker/strongswan/docker-compose.yml exec -T moon /bin/sh -c 'ipsec statusall || true' | grep '64 bytes_i' && break || (docker-compose -f testdata/docker/strongswan/docker-compose.yml up -d --force-recreate && sleep 30)
4036
done
41-
docker-compose -f testdata/docker/libreswan/docker-compose.yml exec -T moon /bin/sh -c 'ipsec status || true'
37+
docker-compose -f testdata/docker/strongswan/docker-compose.yml exec -T moon /bin/sh -c 'ipsec statusall || true'
38+
- name: Install Go
39+
uses: actions/setup-go@v2
40+
with:
41+
go-version: ${{ matrix.go-version }}
4242
- name: Test
4343
run: go test -coverprofile=coverage.txt -covermode=atomic ./...
4444
- name: Upload coverage to Codecov

testdata/docker/libreswan/moon/Dockerfile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,18 @@ FROM debian:bullseye
22

33
RUN set -x \
44
&& apt-get update \
5-
&& apt-get install -y libreswan iputils-ping \
5+
&& apt-get install -y libreswan \
66
&& rm -rf /var/lib/apt/lists/* \
77
&& set +x
88

99
RUN mkdir -p /run/pluto
1010

11+
RUN set -x \
12+
&& apt-get update \
13+
&& apt-get install -y iputils-ping \
14+
&& rm -rf /var/lib/apt/lists/* \
15+
&& set +x
16+
1117
COPY rootfs /
1218

1319
ENTRYPOINT ["/docker-entrypoint.sh"]

testdata/docker/strongswan/moon/Dockerfile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,13 @@ FROM debian:bullseye
22

33
RUN set -x \
44
&& apt-get update \
5-
&& apt-get install -y iputils-ping strongswan-charon strongswan-swanctl \
5+
&& apt-get install -y strongswan-charon strongswan-swanctl \
6+
&& rm -rf /var/lib/apt/lists/* \
7+
&& set +x
8+
9+
RUN set -x \
10+
&& apt-get update \
11+
&& apt-get install -y iputils-ping \
612
&& rm -rf /var/lib/apt/lists/* \
713
&& set +x
814

0 commit comments

Comments
 (0)