Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dockerfile is buggy: modules/Dockerfile.alpine #518

Closed
AnubhavUjjawal opened this issue Mar 10, 2021 · 4 comments
Closed

Dockerfile is buggy: modules/Dockerfile.alpine #518

AnubhavUjjawal opened this issue Mar 10, 2021 · 4 comments

Comments

@AnubhavUjjawal
Copy link

In the line

&& hg clone https://hg.nginx.org/pkg-oss/ \
we are cloning https://hg.nginx.org/pkg-oss/ . But updates to that repository such as updating Nginx to 1.19.8 fail the docker build for earlier versions.

For example, If I use the current mainline-alpine (1.19.7-alpine) as builder, build fails.

To mitigate this, we can checkout to a specific revision using hg update -r <rev> after clone.

@thresheek
Copy link
Collaborator

Hi @AnubhavUjjawal,

Can you try the following patch on top of Dockerfile.alpine:

diff --git a/modules/Dockerfile.alpine b/modules/Dockerfile.alpine
index b2b8b3e..ec64282 100644
--- a/modules/Dockerfile.alpine
+++ b/modules/Dockerfile.alpine
@@ -47,9 +47,9 @@ RUN set -ex \
         elif make -C /pkg-oss/alpine list | grep -E "^$module\s+\d+" > /dev/null; then \
             echo "Building $module from pkg-oss sources"; \
             cd /pkg-oss/alpine; \
-            make abuild-module-$module BASE_VERSION=$NGINX_VERSION; \
+            make abuild-module-$module BASE_VERSION=$NGINX_VERSION NGINX_VERSION=$NGINX_VERSION; \
             apk add $(. ./abuild-module-$module/APKBUILD; echo $makedepends;); \
-            make module-$module BASE_VERSION=$NGINX_VERSION; \
+            make module-$module BASE_VERSION=$NGINX_VERSION NGINX_VERSION=$NGINX_VERSION; \
             find ~/packages -type f -name "*.apk" -exec mv -v {} /tmp/packages/ \;; \
         else \
             echo "Don't know how to build $module module, exiting"; \

With your proposal, checking out a correct revision is also a good option; the reason it's not there is I wanted to have "latest and greatest" modules versions available, and not specifically tied to a specific release. Maybe we should make it configurable somehow.

@AnubhavUjjawal
Copy link
Author

@thresheek I am using a custom version of /modules/Dockerfile.alpine.

However, according to me, docker images built using Dockerfile should be reproducible if we provide the same ARG and ENV every time we build an image, that's why I came up with an initial approach of updating the revision. Packages break compatibility all the time, hence having "latest and greatest" modules versions available isn't the best approach a/c to me.

@thresheek
Copy link
Collaborator

Many thanks for your feedback!

I agree, I'll fix the Dockerfiles to be reproducible.

@gnought
Copy link

gnought commented Mar 15, 2021

The root clause is NGINX_VERSION is hard-coded to 1.19.8 in pkg-oss/contrib/src/nginx/version

The simple hot fix for

&& hg clone https://hg.nginx.org/pkg-oss/ \
&& cd pkg-oss \

is

&& hg clone https://hg.nginx.org/pkg-oss/ \ 
&& cd pkg-oss \ 
&& sed -i 's/^NGINX_VERISON/# NGINX_VERSION/' contrib/src/nginx/version \

Jompee47 pushed a commit to Jompee47/docker-nginx that referenced this issue Apr 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants