Skip to content

Commit ed6073f

Browse files
committed
Use env: sections for both test steps in GitHub Actions
- Add env: section to Test NGINX configuration step - Remove inline environment variable setting from run commands - Consistent and cleaner GitHub Actions workflow
1 parent 6429b92 commit ed6073f

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

.github/workflows/docker.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,24 @@ jobs:
2525
echo "tag=$TAG" >> $GITHUB_OUTPUT
2626
2727
- name: Test NGINX configuration
28+
env:
29+
UPSTREAM_SERVER: owl.virtualflybrain.org:80
30+
CACHE_MAX_SIZE: 20g
31+
DNS_RESOLVER: 8.8.8.8
2832
run: |
29-
UPSTREAM_SERVER=owl.virtualflybrain.org:80 CACHE_MAX_SIZE=20g DNS_RESOLVER="8.8.8.8 1.1.1.1" envsubst '${UPSTREAM_SERVER} ${CACHE_MAX_SIZE} ${DNS_RESOLVER}' < nginx.conf.template > test-nginx.conf
33+
envsubst '${UPSTREAM_SERVER} ${CACHE_MAX_SIZE} ${DNS_RESOLVER}' < nginx.conf.template > test-nginx.conf
3034
docker run --rm -v $(pwd)/test-nginx.conf:/tmp/nginx.conf nginx:1.26-alpine nginx -t -c /tmp/nginx.conf
3135
3236
- name: Build test Docker image
3337
run: docker build --no-cache . --file Dockerfile --tag test-image
3438

3539
- name: Test container startup
40+
env:
41+
UPSTREAM_SERVER: owl.virtualflybrain.org:80
42+
CACHE_MAX_SIZE: 20g
43+
DNS_RESOLVER: 8.8.8.8
3644
run: |
37-
docker run -d --name test-container -e UPSTREAM_SERVER=owl.virtualflybrain.org:80 -e CACHE_MAX_SIZE=20g -e DNS_RESOLVER="8.8.8.8 1.1.1.1" test-image
45+
docker run -d --name test-container test-image
3846
sleep 5
3947
if docker ps | grep -q test-container; then
4048
echo "Container is running successfully"

0 commit comments

Comments
 (0)