This repository has been archived by the owner on Jul 20, 2022. It is now read-only.
generated from homecentr/docker-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Non-root user support via S6 overlay, automated tests added
- Loading branch information
Showing
32 changed files
with
616 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
* text=auto | ||
*.sh eol=lf | ||
*.sh eol=lf | ||
**/run eol=lf | ||
*/services.d/* eol=lf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,23 @@ | ||
**/*.bind | ||
**/*.bind.jnl | ||
node_modules | ||
|
||
*.class | ||
*.jar | ||
*.war | ||
*.ear | ||
.gradle | ||
build | ||
.gradletasknamecache | ||
|
||
**/.idea/workspace.xml | ||
**/.idea/tasks.xml | ||
|
||
# Ignore Gradle GUI config | ||
gradle-app.setting | ||
|
||
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) | ||
!gradle-wrapper.jar | ||
|
||
# Cache of project | ||
.gradletasknamecache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,22 @@ | ||
FROM homecentr/base:1.0.0 as base | ||
|
||
FROM alpine:3.11.2 | ||
|
||
LABEL maintainer="Lukas Holota <[email protected]>" | ||
|
||
RUN apk add --no-cache bind=9.14.8-r5 libcap=2.27-r0 && \ | ||
# Create directory for built-in configs | ||
mkdir /config-default && \ | ||
# Prepare directory for pid file so that also non-root user can write into it | ||
chmod 0757 /var/run/named && \ | ||
# Copy S6 overlay and shared scripts | ||
COPY --from=base / / | ||
|
||
# Copy S6 scripts & default configs | ||
COPY ./fs/ / | ||
|
||
RUN apk add --no-cache \ | ||
bind=9.14.8-r5 \ | ||
libcap=2.27-r0 \ | ||
shadow=4.7-r1 && \ | ||
# Grant the named process to open a well-known port (1-1024) which normally requires root permissions | ||
setcap 'cap_net_bind_service=+ep' /usr/sbin/named | ||
|
||
COPY ./config/named.conf /config-default/ | ||
COPY ./config/healthcheck.conf /config-default/ | ||
COPY ./config/healthcheck.zone /config-default/ | ||
|
||
HEALTHCHECK --interval=10s --timeout=3s --start-period=10s --retries=3 CMD [ "nslookup", "ns1.bind9-healthcheck", "127.0.0.1" ] | ||
|
||
# Config directory | ||
|
@@ -28,4 +31,4 @@ EXPOSE 953/tcp | |
# Default statistics port, not opened by default, must be configured | ||
EXPOSE 8888/tcp | ||
|
||
ENTRYPOINT ["/usr/sbin/named", "-f", "-g", "-4", "-c", "/config-default/named.conf"] | ||
ENTRYPOINT ["/init"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,4 +10,9 @@ options { | |
8.8.8.8; | ||
8.8.4.4; | ||
}; | ||
}; | ||
|
||
zone test { | ||
type master; | ||
file "/config/test.zone"; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
$ORIGIN test. | ||
$TTL 86400 | ||
@ SOA ns1.test. hostmaster.test. ( | ||
2001062501 ; serial | ||
10 | ||
10 | ||
10 | ||
10 ) | ||
; | ||
NS ns1.bind9-healthcheck. | ||
some-record A 127.0.0.122 |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/with-contenv ash | ||
|
||
chown -R nonroot:nonroot /var/run/named | ||
chown -R nonroot:nonroot /config-default |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/usr/bin/execlineb -S1 | ||
|
||
s6-svscanctl -t /var/run/s6/services |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/usr/bin/execlineb -P | ||
|
||
s6-setuidgid nonroot | ||
|
||
/usr/sbin/named -f -g -4 -c /config-default/named.conf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="src" output="bin/main" path="src/main/java"> | ||
<attributes> | ||
<attribute name="gradle_scope" value="main"/> | ||
<attribute name="gradle_used_by_scope" value="main,test"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="src" output="bin/main" path="src/main/resources"> | ||
<attributes> | ||
<attribute name="gradle_scope" value="main"/> | ||
<attribute name="gradle_used_by_scope" value="main,test"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="src" output="bin/test" path="src/test/java"> | ||
<attributes> | ||
<attribute name="gradle_scope" value="test"/> | ||
<attribute name="gradle_used_by_scope" value="test"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="src" output="bin/test" path="src/test/resources"> | ||
<attributes> | ||
<attribute name="gradle_scope" value="test"/> | ||
<attribute name="gradle_used_by_scope" value="test"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8/"/> | ||
<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/> | ||
<classpathentry kind="output" path="bin/default"/> | ||
</classpath> |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>docker-dns-tests</name> | ||
<comment>Project tests created by Buildship.</comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.jdt.core.javabuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>org.eclipse.buildship.core.gradleprojectbuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.eclipse.jdt.core.javanature</nature> | ||
<nature>org.eclipse.buildship.core.gradleprojectnature</nature> | ||
</natures> | ||
</projectDescription> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
connection.project.dir= | ||
eclipse.preferences.version=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
plugins { | ||
id 'java' | ||
} | ||
|
||
group 'org.homecentr' | ||
version '1.0-SNAPSHOT' | ||
|
||
sourceCompatibility = 1.8 | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
testImplementation group: 'junit', name: 'junit', version: '4.12' | ||
testImplementation "org.testcontainers:testcontainers:1.12.5" | ||
testImplementation "dnsjava:dnsjava:2.1.9" | ||
testImplementation group: 'org.slf4j', name: 'slf4j-api', version: '1.7.30' | ||
testImplementation group: 'org.slf4j', name: 'slf4j-simple', version: '1.7.30' | ||
} | ||
|
||
test { | ||
systemProperty 'image_tag', System.getProperty('image_tag') | ||
afterTest { desc, result -> | ||
logger.quiet "Executing test ${desc.name} [${desc.className}] with result: ${result.resultType}" | ||
} | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\:https://services.gradle.org/distributions/gradle-5.2.1-bin.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
Oops, something went wrong.