jlesage / docker-baseimage-gui

A minimal docker baseimage to ease creation of X graphical application containers
MIT License
1.2k stars 179 forks source link

Alpine mirrors support #110

Closed flying19880517 closed 1 year ago

flying19880517 commented 1 year ago

In my country, install packages from alpinelinux.org are very slow, usually we use mirrors for speed. How about support set mirror url by Environment Variables?

https://github.com/jlesage/docker-baseimage-gui/blob/a246245ad6e7a76a0083fb2218faa15f8b5d870b/README.md?plain=1#L159 https://github.com/jlesage/docker-baseimage-gui/blob/a246245ad6e7a76a0083fb2218faa15f8b5d870b/rootfs/etc/cont-init.d/10-cjk-font.sh#L13

jlesage commented 1 year ago

Ok, I will try to see if this can be implemented in a generic way, to support all baseimage types.

gofunn commented 1 year ago

We can check if a env is empty, and if it is, do nothing.

I use it in a Dockerfile to change it.

ENV APT_MIRROR="mirrors.xxx.com"

RUN sed -i "s/deb.debian.org/${APT_MIRROR}/g" /etc/apt/sources.list \
&&  sed -i "s/security.debian.org/${APT_MIRROR}/g" /etc/apt/sources.list \
&&  sed -i "s/archive.ubuntu.com/${APT_MIRROR}/g" /etc/apt/sources.list \
&&  sed -i "s/security.ubuntu.com/${APT_MIRROR}/g" /etc/apt/sources.list \
&&  apt-get update && apt-get install -y --no-install-recommends curl \
&&  rm -rf /var/lib/apt/lists/*

Ok, I will try to see if this can be implemented in a generic way, to support all baseimage types.

jlesage commented 1 year ago

This is now implemented via the PACKAGES_MIRROR environment variable.