Skip to content

Commit cff9b1e

Browse files
committed
Fix CI/CD pipeline: Use shell parameter expansion for env vars in CMD
- Replace explicit exports with shell parameter expansion in Dockerfile CMD - Use defaults when environment variables aren't set - Simplify GitHub Actions workflow to test with defaults - Container now starts successfully with proper nginx configuration
1 parent 611603b commit cff9b1e

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

.github/workflows/docker.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ jobs:
3232
- name: Build test Docker image
3333
run: docker build --no-cache . --file Dockerfile --tag test-image
3434

35-
- name: Test Docker image
35+
- name: Test container startup
3636
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
37+
docker run -d --name test-container test-image
3838
sleep 5
3939
if docker ps | grep -q test-container; then
4040
echo "Container is running successfully"

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ RUN mkdir -p /var/cache/nginx && chown -R nginx:nginx /var/cache/nginx && \
1616

1717
EXPOSE 80
1818

19-
CMD ["/bin/sh", "-c", "export UPSTREAM_SERVER=$UPSTREAM_SERVER && export CACHE_MAX_SIZE=$CACHE_MAX_SIZE && export DNS_RESOLVER=\"$DNS_RESOLVER\" && envsubst '${UPSTREAM_SERVER} ${CACHE_MAX_SIZE} ${DNS_RESOLVER}' < /etc/nginx/nginx.conf.template > /etc/nginx/nginx.conf && /usr/local/bin/health-monitor.sh & nginx -g 'daemon off;'"]
19+
CMD ["/bin/sh", "-c", "UPSTREAM_SERVER=${UPSTREAM_SERVER:-owl.virtualflybrain.org:80} CACHE_MAX_SIZE=${CACHE_MAX_SIZE:-20g} DNS_RESOLVER=${DNS_RESOLVER:-8.8.8.8 1.1.1.1} envsubst '${UPSTREAM_SERVER} ${CACHE_MAX_SIZE} ${DNS_RESOLVER}' < /etc/nginx/nginx.conf.template > /etc/nginx/nginx.conf && /usr/local/bin/health-monitor.sh & nginx -g 'daemon off;'"]

0 commit comments

Comments
 (0)