Skip to content

Commit a60e777

Browse files
authored
Merge pull request #3 from linuxserver/nginx
Switch to nginx
2 parents d228e0b + 8cfbc45 commit a60e777

File tree

13 files changed

+397
-165
lines changed

13 files changed

+397
-165
lines changed

.github/workflows/external_trigger.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ jobs:
2020
echo "**** External trigger running off of main branch. To disable this trigger, set a Github secret named \"PAUSE_EXTERNAL_TRIGGER_SOCKET_PROXY_MAIN\". ****"
2121
echo "External trigger running off of main branch. To disable this trigger, set a Github secret named \`PAUSE_EXTERNAL_TRIGGER_SOCKET_PROXY_MAIN\`" >> $GITHUB_STEP_SUMMARY
2222
echo "**** Retrieving external version ****"
23-
EXT_RELEASE=$(docker run --rm quay.io/skopeo/stable:v1 inspect docker://docker.io/haproxy:lts-alpine | jq -r '.Env[] | select(startswith("HAPROXY_VERSION")) | split("=")[1]')
23+
EXT_RELEASE=$(curl -sL "http://dl-cdn.alpinelinux.org/alpine/v3.19/main/x86_64/APKINDEX.tar.gz" | tar -xz -C /tmp \
24+
&& awk '/^P:'"nginx"'$/,/V:/' /tmp/APKINDEX | sed -n 2p | sed 's/^V://')
2425
if [ -z "${EXT_RELEASE}" ] || [ "${EXT_RELEASE}" == "null" ]; then
2526
echo "**** Can't retrieve external version, exiting ****"
2627
FAILURE_REASON="Can't retrieve external version for socket-proxy branch main"
@@ -73,6 +74,14 @@ jobs:
7374
echo "**** Version ${EXT_RELEASE} already pushed, exiting ****"
7475
echo "Version ${EXT_RELEASE} already pushed, exiting" >> $GITHUB_STEP_SUMMARY
7576
exit 0
77+
elif [[ $(curl -sL "http://dl-cdn.alpinelinux.org/alpine/v3.19/main/aarch64/APKINDEX.tar.gz" | tar -xz -C /tmp && awk '/^P:'"nginx"'$/,/V:/' /tmp/APKINDEX | sed -n 2p | sed 's/^V://') != "${EXT_RELEASE}" ]]; then
78+
echo "**** New version ${EXT_RELEASE} found; but not all arch repos updated yet; exiting ****"
79+
echo "New version ${EXT_RELEASE} found; but not all arch repos updated yet; exiting" >> $GITHUB_STEP_SUMMARY
80+
FAILURE_REASON="New version ${EXT_RELEASE} for socket-proxy tag latest is detected, however not all arch repos are updated yet. Will try again later."
81+
curl -X POST -H "Content-Type: application/json" --data '{"avatar_url": "https://cdn.discordapp.com/avatars/354986384542662657/df91181b3f1cf0ef1592fbe18e0962d7.png","embeds": [{"color": 9802903,
82+
"description": "**Trigger Failed** \n**Reason:** '"${FAILURE_REASON}"' \n"}],
83+
"username": "Github Actions"}' ${{ secrets.DISCORD_WEBHOOK }}
84+
exit 0
7685
elif [ $(curl -s https://ci.linuxserver.io/job/Docker-Pipeline-Builders/job/docker-socket-proxy/job/main/lastBuild/api/json | jq -r '.building') == "true" ]; then
7786
echo "**** New version ${EXT_RELEASE} found; but there already seems to be an active build on Jenkins; exiting ****"
7887
echo "New version ${EXT_RELEASE} found; but there already seems to be an active build on Jenkins; exiting" >> $GITHUB_STEP_SUMMARY

Dockerfile

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
# syntax=docker/dockerfile:1
22

3-
ARG HAPROXY_VERSION
4-
5-
FROM haproxy:${HAPROXY_VERSION:-lts}-alpine
3+
FROM docker.io/alpine:3.19
64

75
# set version label
86
ARG BUILD_DATE
97
ARG VERSION
8+
ARG NGINX_VERSION
109
LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}"
1110
LABEL maintainer="thespad"
1211

@@ -18,13 +17,11 @@ ENV ALLOW_RESTARTS=0 \
1817
COMMIT=0 \
1918
CONFIGS=0 \
2019
CONTAINERS=0 \
21-
DISABLE_IPV6=0 \
2220
DISTRIBUTION=0 \
2321
EVENTS=1 \
2422
EXEC=0 \
2523
IMAGES=0 \
2624
INFO=0 \
27-
LOG_LEVEL=info \
2825
NETWORKS=0 \
2926
NODES=0 \
3027
PING=1 \
@@ -40,8 +37,26 @@ ENV ALLOW_RESTARTS=0 \
4037
VERSION=1 \
4138
VOLUMES=0
4239

43-
USER root
40+
# install packages
41+
RUN \
42+
echo "**** install build packages ****" && \
43+
apk add --no-cache \
44+
alpine-release \
45+
bash \
46+
curl \
47+
envsubst && \
48+
if [ -z ${NGINX_VERSION+x} ]; then \
49+
NGINX_VERSION=$(curl -sL "http://dl-cdn.alpinelinux.org/alpine/v3.19/main/x86_64/APKINDEX.tar.gz" | tar -xz -C /tmp \
50+
&& awk '/^P:nginx$/,/V:/' /tmp/APKINDEX | sed -n 2p | sed 's/^V://'); \
51+
fi && \
52+
apk add --no-cache \
53+
nginx==${NGINX_VERSION} && \
54+
rm -f /etc/nginx/conf.d/stream.conf && \
55+
rm -f /etc/nginx/http.d/default.conf
4456

45-
COPY haproxy.cfg /usr/local/etc/haproxy/haproxy.cfg
57+
# add local files
58+
COPY root/ /
4659

4760
EXPOSE 2375
61+
62+
ENTRYPOINT ["/docker-entrypoint.sh"]

Dockerfile.aarch64

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
# syntax=docker/dockerfile:1
22

3-
ARG HAPROXY_VERSION
4-
5-
FROM haproxy:${HAPROXY_VERSION:-lts}-alpine
3+
FROM docker.io/alpine:3.19
64

75
# set version label
86
ARG BUILD_DATE
97
ARG VERSION
8+
ARG NGINX_VERSION
109
LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}"
1110
LABEL maintainer="thespad"
1211

@@ -18,13 +17,11 @@ ENV ALLOW_RESTARTS=0 \
1817
COMMIT=0 \
1918
CONFIGS=0 \
2019
CONTAINERS=0 \
21-
DISABLE_IPV6=0 \
2220
DISTRIBUTION=0 \
2321
EVENTS=1 \
2422
EXEC=0 \
2523
IMAGES=0 \
2624
INFO=0 \
27-
LOG_LEVEL=info \
2825
NETWORKS=0 \
2926
NODES=0 \
3027
PING=1 \
@@ -40,8 +37,26 @@ ENV ALLOW_RESTARTS=0 \
4037
VERSION=1 \
4138
VOLUMES=0
4239

43-
USER root
40+
# install packages
41+
RUN \
42+
echo "**** install build packages ****" && \
43+
apk add --no-cache \
44+
alpine-release \
45+
bash \
46+
curl \
47+
envsubst && \
48+
if [ -z ${NGINX_VERSION+x} ]; then \
49+
NGINX_VERSION=$(curl -sL "http://dl-cdn.alpinelinux.org/alpine/v3.19/main/x86_64/APKINDEX.tar.gz" | tar -xz -C /tmp \
50+
&& awk '/^P:nginx$/,/V:/' /tmp/APKINDEX | sed -n 2p | sed 's/^V://'); \
51+
fi && \
52+
apk add --no-cache \
53+
nginx==${NGINX_VERSION} && \
54+
rm -f /etc/nginx/conf.d/stream.conf && \
55+
rm -f /etc/nginx/http.d/default.conf
4456

45-
COPY haproxy.cfg /usr/local/etc/haproxy/haproxy.cfg
57+
# add local files
58+
COPY root/ /
4659

4760
EXPOSE 2375
61+
62+
ENTRYPOINT ["/docker-entrypoint.sh"]

Jenkinsfile

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,17 @@ pipeline {
1717
GITLAB_TOKEN=credentials('b6f0f1dd-6952-4cf6-95d1-9c06380283f0')
1818
GITLAB_NAMESPACE=credentials('gitlab-namespace-id')
1919
DOCKERHUB_TOKEN=credentials('docker-hub-ci-pat')
20-
BUILD_VERSION_ARG = 'HAPROXY_VERSION'
20+
BUILD_VERSION_ARG = 'NGINX_VERSION'
2121
LS_USER = 'linuxserver'
2222
LS_REPO = 'docker-socket-proxy'
2323
CONTAINER_NAME = 'socket-proxy'
2424
DOCKERHUB_IMAGE = 'linuxserver/socket-proxy'
2525
DEV_DOCKERHUB_IMAGE = 'lsiodev/socket-proxy'
2626
PR_DOCKERHUB_IMAGE = 'lspipepr/socket-proxy'
2727
DIST_IMAGE = 'alpine'
28+
DIST_TAG = '3.19'
29+
DIST_REPO = 'http://dl-cdn.alpinelinux.org/alpine/v3.19/main/'
30+
DIST_REPO_PACKAGES = 'nginx'
2831
MULTIARCH='true'
2932
CI='false'
3033
CI_WEB='false'
@@ -110,14 +113,15 @@ pipeline {
110113
/* ########################
111114
External Release Tagging
112115
######################## */
113-
// If this is a custom command to determine version use that command
114-
stage("Set tag custom bash"){
116+
// If this is an alpine repo change for external version determine an md5 from the version string
117+
stage("Set tag Alpine Repo"){
115118
steps{
116119
script{
117120
env.EXT_RELEASE = sh(
118-
script: ''' docker run --rm quay.io/skopeo/stable:v1 inspect docker://docker.io/haproxy:lts-alpine | jq -r '.Env[] | select(startswith("HAPROXY_VERSION")) | split("=")[1]' ''',
121+
script: '''curl -sL "${DIST_REPO}x86_64/APKINDEX.tar.gz" | tar -xz -C /tmp \
122+
&& awk '/^P:'"${DIST_REPO_PACKAGES}"'$/,/V:/' /tmp/APKINDEX | sed -n 2p | sed 's/^V://' ''',
119123
returnStdout: true).trim()
120-
env.RELEASE_LINK = 'custom_command'
124+
env.RELEASE_LINK = 'alpine_repo'
121125
}
122126
}
123127
}
@@ -837,11 +841,11 @@ pipeline {
837841
"tagger": {"name": "LinuxServer Jenkins","email": "jenkins@linuxserver.io","date": "'${GITHUB_DATE}'"}}' '''
838842
echo "Pushing New release for Tag"
839843
sh '''#! /bin/bash
840-
echo "Updating to ${EXT_RELEASE_CLEAN}" > releasebody.json
844+
echo "Updating external repo packages to ${EXT_RELEASE_CLEAN}" > releasebody.json
841845
echo '{"tag_name":"'${META_TAG}'",\
842846
"target_commitish": "main",\
843847
"name": "'${META_TAG}'",\
844-
"body": "**LinuxServer Changes:**\\n\\n'${LS_RELEASE_NOTES}'\\n\\n**Remote Changes:**\\n\\n' > start
848+
"body": "**LinuxServer Changes:**\\n\\n'${LS_RELEASE_NOTES}'\\n\\n**Repo Changes:**\\n\\n' > start
845849
printf '","draft": false,"prerelease": false}' >> releasebody.json
846850
paste -d'\\0' start releasebody.json > releasebody.json.done
847851
curl -H "Authorization: token ${GITHUB_TOKEN}" -X POST https://api.github.com/repos/${LS_USER}/${LS_REPO}/releases -d @releasebody.json.done'''

README.md

Lines changed: 29 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ Find us at:
3232
[![Docker Stars](https://img.shields.io/docker/stars/linuxserver/socket-proxy.svg?color=94398d&labelColor=555555&logoColor=ffffff&style=for-the-badge&label=stars&logo=docker)](https://hub.docker.com/r/linuxserver/socket-proxy)
3333
[![Jenkins Build](https://img.shields.io/jenkins/build?labelColor=555555&logoColor=ffffff&style=for-the-badge&jobUrl=https%3A%2F%2Fci.linuxserver.io%2Fjob%2FDocker-Pipeline-Builders%2Fjob%2Fdocker-socket-proxy%2Fjob%2Fmain%2F&logo=jenkins)](https://ci.linuxserver.io/job/Docker-Pipeline-Builders/job/docker-socket-proxy/job/main/)
3434

35-
[Socket-proxy](https://github.com/Tecnativa/docker-socket-proxy) is a security-enhanced proxy for the Docker Socket.
35+
Socket proxy is a security-enhanced proxy for the Docker Socket.
3636

37-
[![socket-proxy](https://raw.githubusercontent.com/linuxserver/docker-templates/master/linuxserver.io/img/docker-logo.png)](https://github.com/Tecnativa/docker-socket-proxy)
37+
![socket-proxy](https://raw.githubusercontent.com/linuxserver/docker-templates/master/linuxserver.io/img/docker-logo.png)
3838

3939
## Supported Architectures
4040

@@ -52,9 +52,9 @@ The architectures supported by this image are:
5252

5353
## Application Setup
5454

55-
This container is a fork of [https://github.com/Tecnativa/docker-socket-proxy](https://github.com/Tecnativa/docker-socket-proxy) and as such does not follow our usual container conventions. It *does not* support mods or custom scripts/services, or running as a user other than root (or the docker user in a rootless environment).
55+
This container is based on [https://github.com/Tecnativa/docker-socket-proxy](https://github.com/Tecnativa/docker-socket-proxy) and as such does not follow our usual container conventions. It *does not* support mods or custom scripts/services, or running as a user other than root (or the docker user in a rootless environment).
5656

57-
The container should be run on the same docker network as the service(s) using it. Most containers that would normally connect to a mounted docker.sock can have their endpoint overridden using the `DOCKER_HOST` environment variable if they do not offer the option in their configuration; it should typically be pointed to tcp://socket-proxy:2375.
57+
The container should be run on the same docker network as the service(s) using it. Most containers that would normally connect to a mounted docker.sock can have their endpoint overridden using the `DOCKER_HOST` environment variable if they do not offer the option in their configuration; it should typically be pointed to `tcp://socket-proxy:2375`.
5858

5959
* Never expose this container's port to a public network. It should be treated the same way you would treat the docker socket or TCP endpoint.
6060
* Revoke access to any API section that you consider your service should not need.
@@ -74,34 +74,32 @@ services:
7474
image: lscr.io/linuxserver/socket-proxy:latest
7575
container_name: socket-proxy
7676
environment:
77-
- EVENTS=1 #optional
78-
- PING=1 #optional
79-
- VERSION=1 #optional
77+
- ALLOW_START=0 #optional
78+
- ALLOW_STOP=0 #optional
79+
- ALLOW_RESTARTS=0 #optional
8080
- AUTH=0 #optional
81-
- SECRETS=0 #optional
82-
- POST=0 #optional
8381
- BUILD=0 #optional
8482
- COMMIT=0 #optional
8583
- CONFIGS=0 #optional
8684
- CONTAINERS=0 #optional
87-
- ALLOW_START=0 #optional
88-
- ALLOW_STOP=0 #optional
89-
- ALLOW_RESTARTS=0 #optional
9085
- DISTRIBUTION=0 #optional
86+
- EVENTS=1 #optional
9187
- EXEC=0 #optional
9288
- IMAGES=0 #optional
9389
- INFO=0 #optional
94-
- LOG_LEVEL=info #optional
9590
- NETWORKS=0 #optional
9691
- NODES=0 #optional
92+
- PING=1 #optional
93+
- POST=0 #optional
9794
- PLUGINS=0 #optional
95+
- SECRETS=0 #optional
9896
- SERVICES=0 #optional
9997
- SESSION=0 #optional
10098
- SWARM=0 #optional
10199
- SYSTEM=0 #optional
102100
- TASKS=0 #optional
101+
- VERSION=1 #optional
103102
- VOLUMES=0 #optional
104-
- DISABLE_IPV6=0 #optional
105103
volumes:
106104
- /var/run/docker.sock:/var/run/docker.sock:ro
107105
restart: unless-stopped
@@ -115,34 +113,32 @@ services:
115113
```bash
116114
docker run -d \
117115
--name=socket-proxy \
118-
-e EVENTS=1 `#optional` \
119-
-e PING=1 `#optional` \
120-
-e VERSION=1 `#optional` \
116+
-e ALLOW_START=0 `#optional` \
117+
-e ALLOW_STOP=0 `#optional` \
118+
-e ALLOW_RESTARTS=0 `#optional` \
121119
-e AUTH=0 `#optional` \
122-
-e SECRETS=0 `#optional` \
123-
-e POST=0 `#optional` \
124120
-e BUILD=0 `#optional` \
125121
-e COMMIT=0 `#optional` \
126122
-e CONFIGS=0 `#optional` \
127123
-e CONTAINERS=0 `#optional` \
128-
-e ALLOW_START=0 `#optional` \
129-
-e ALLOW_STOP=0 `#optional` \
130-
-e ALLOW_RESTARTS=0 `#optional` \
131124
-e DISTRIBUTION=0 `#optional` \
125+
-e EVENTS=1 `#optional` \
132126
-e EXEC=0 `#optional` \
133127
-e IMAGES=0 `#optional` \
134128
-e INFO=0 `#optional` \
135-
-e LOG_LEVEL=info `#optional` \
136129
-e NETWORKS=0 `#optional` \
137130
-e NODES=0 `#optional` \
131+
-e PING=1 `#optional` \
132+
-e POST=0 `#optional` \
138133
-e PLUGINS=0 `#optional` \
134+
-e SECRETS=0 `#optional` \
139135
-e SERVICES=0 `#optional` \
140136
-e SESSION=0 `#optional` \
141137
-e SWARM=0 `#optional` \
142138
-e SYSTEM=0 `#optional` \
143139
-e TASKS=0 `#optional` \
140+
-e VERSION=1 `#optional` \
144141
-e VOLUMES=0 `#optional` \
145-
-e DISABLE_IPV6=0 `#optional` \
146142
-v /var/run/docker.sock:/var/run/docker.sock:ro \
147143
--restart unless-stopped \
148144
--read-only \
@@ -156,34 +152,32 @@ Containers are configured using parameters passed at runtime (such as those abov
156152

157153
| Parameter | Function |
158154
| :----: | --- |
159-
| `-e EVENTS=1` | `/events` |
160-
| `-e PING=1` | `/_ping` |
161-
| `-e VERSION=1` | `/version` |
155+
| `-e ALLOW_START=0` | `/containers/id/start` |
156+
| `-e ALLOW_STOP=0` | `/containers/id/stop` |
157+
| `-e ALLOW_RESTARTS=0` | `/containers/id/stop`, `/containers/id/restart`, and `/containers/id/kill` |
162158
| `-e AUTH=0` | `/auth` |
163-
| `-e SECRETS=0` | `/secrets` |
164-
| `-e POST=0` | When set to `0`, only `GET` and `HEAD` operations are allowed, making API access read-only. |
165159
| `-e BUILD=0` | `/build` |
166160
| `-e COMMIT=0` | `/commit` |
167161
| `-e CONFIGS=0` | `/configs` |
168162
| `-e CONTAINERS=0` | `/containers` |
169-
| `-e ALLOW_START=0` | `/containers/id/start` |
170-
| `-e ALLOW_STOP=0` | `/containers/id/stop` |
171-
| `-e ALLOW_RESTARTS=0` | `/containers/id/stop`, `/containers/id/restart`, and `/containers/id/kill` |
172163
| `-e DISTRIBUTION=0` | `/distribution` |
164+
| `-e EVENTS=1` | `/events` |
173165
| `-e EXEC=0` | `/exec` & `/containers/{id}/exec` |
174166
| `-e IMAGES=0` | `/images` |
175167
| `-e INFO=0` | `/info` |
176-
| `-e LOG_LEVEL=info` | Default value is `info`. Possible values are: `debug`, `info`, `notice`, `warning`, `err`, `crit`, `alert`, and `emerg`. |
177168
| `-e NETWORKS=0` | `/networks` |
178169
| `-e NODES=0` | `/nodes` |
170+
| `-e PING=1` | `/_ping` |
179171
| `-e PLUGINS=0` | `/plugins` |
172+
| `-e POST=0` | When set to `0`, only `GET` and `HEAD` operations are allowed, making API access read-only. |
173+
| `-e SECRETS=0` | `/secrets` |
180174
| `-e SERVICES=0` | `/services` |
181175
| `-e SESSION=0` | `/session` |
182176
| `-e SWARM=0` | `/swarm` |
183177
| `-e SYSTEM=0` | `/system` |
184178
| `-e TASKS=0` | `/tasks` |
179+
| `-e VERSION=1` | `/version` |
185180
| `-e VOLUMES=0` | `/volumes` |
186-
| `-e DISABLE_IPV6=0` | Set to `1` to disable IPv6 bindings in scenarios where the host cannot support it. |
187181
| `-v /var/run/docker.sock:ro` | Mount the host docker socket into the container. |
188182
| `--read-only` | Make the container filesystem read-only. |
189183
| `--tmpfs /run` | Mount /run to tmpfs (RAM) to make it writeable. |
@@ -307,4 +301,5 @@ Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64
307301

308302
## Versions
309303

304+
* **08.04.24:** - Use nginx due to haproxy's wonky websockets handling.
310305
* **07.04.24:** - Initial Release.

0 commit comments

Comments
 (0)