Skip to content

Commit 0eacda2

Browse files
authored
Merge pull request #42 from dokku-community/apt-conf-support
Add support for an apt.conf override file
2 parents 4febaac + 8f56cdf commit 0eacda2

File tree

2 files changed

+26
-10
lines changed

2 files changed

+26
-10
lines changed

README.md

+19-8
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,30 @@ When you deploy your project, the dokku-apt plugin will install according to you
2828

2929
The order of operations is:
3030

31-
1. `apt-env`
32-
2. `apt-keys`
33-
3. `apt-preferences`
34-
4. `apt-sources-list`
35-
5. `apt-repositories`
36-
6. `apt-debconf`
37-
7. `apt-packages`
38-
8. `dpkg-packages`
31+
1. `apt-conf`
32+
2. `apt-env`
33+
3. `apt-keys`
34+
4. `apt-preferences`
35+
5. `apt-sources-list`
36+
6. `apt-repositories`
37+
7. `apt-debconf`
38+
8. `apt-packages`
39+
9. `dpkg-packages`
3940

4041
Utilizing the above files, the base build image will be extended for further use in the build process. If an already extended app image that is compatible with the desired changes is found, then the above will be skipped in favor of using the pre-existing image.
4142

4243
Note that specifying packages within a `dpkg-packages` file will always bust the cache, as there is no way for the plugin to know if the files have changed between deploys.
4344

45+
### `apt-conf`
46+
47+
A config file for apt, as documented [here](https://linux.die.net/man/5/apt.conf). This is moved to the folder `/etc/apt/apt.conf.d/99dokku-apt`, and can override any `apt.conf` files that come before it in lexicographical order.
48+
49+
Example
50+
51+
```
52+
Acquire::http::Proxy "http://user:[email protected]:8888/";
53+
```
54+
4455
### `apt-env`
4556

4657
A file that can contain environment variables. Note that this is sourced, and should not contain arbitrary code.

internal-functions

+7-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ fn-apt-fetch-sha() {
2727
return
2828
fi
2929

30-
APT_FILES=('apt-env' 'apt-keys' 'apt-preferences' 'apt-sources-list' 'apt-repositories' 'apt-debconf' 'apt-packages')
30+
APT_FILES=('apt-conf' 'apt-env' 'apt-keys' 'apt-preferences' 'apt-sources-list' 'apt-repositories' 'apt-debconf' 'apt-packages')
3131
for file in "${APT_FILES[@]}"; do
3232
if [[ -f "$SOURCECODE_WORK_DIR/$file" ]]; then
3333
INJECT_PACKAGES=true
@@ -47,7 +47,7 @@ fn-apt-populate-work-dir() {
4747
declare SOURCECODE_WORK_DIR="$1" TMP_WORK_DIR="$2"
4848
local APT_FILES file
4949

50-
APT_FILES=('apt-env' 'apt-keys' 'apt-preferences' 'apt-sources-list' 'apt-repositories' 'apt-debconf' 'apt-packages')
50+
APT_FILES=('apt-conf' 'apt-env' 'apt-keys' 'apt-preferences' 'apt-sources-list' 'apt-repositories' 'apt-debconf' 'apt-packages')
5151
for file in "${APT_FILES[@]}"; do
5252
if [[ -f "$SOURCECODE_WORK_DIR/$file" ]]; then
5353
cp "$SOURCECODE_WORK_DIR/$file" "$TMP_WORK_DIR/$file"
@@ -61,6 +61,11 @@ fn-apt-command() {
6161
# $APP $DOKKU_IMAGE
6262
sleep 2
6363
export DEBIAN_FRONTEND=noninteractive
64+
if [ -f $DIR/apt-conf ]; then
65+
echo "-----> Copying apt-conf file into place"
66+
mv -v $DIR/apt-conf /etc/apt/apt.conf.d/99dokku-apt
67+
fi
68+
6469
if [ -f $DIR/apt-env ]; then
6570
echo "-----> Sourcing apt env"
6671
source $DIR/apt-env

0 commit comments

Comments
 (0)