Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
ARG HAPROXY_VERSION=lts
FROM haproxy:${HAPROXY_VERSION}-alpine

# Alpine publishes fixes before the haproxy base image is rebuilt with them
USER root
RUN apk upgrade --no-cache
USER haproxy

EXPOSE 2375
ENV ALLOW_RESTARTS=0 \

Check warning on line 10 in Dockerfile

View workflow job for this annotation

GitHub Actions / build-test (lts, amd64)

Sensitive data should not be used in the ARG or ENV commands

SecretsUsedInArgOrEnv: Do not use ARG or ENV instructions for sensitive data (ENV "AUTH") More info: https://docs.docker.com/go/dockerfile/rule/secrets-used-in-arg-or-env/

Check warning on line 10 in Dockerfile

View workflow job for this annotation

GitHub Actions / build-test (3.4, amd64)

Sensitive data should not be used in the ARG or ENV commands

SecretsUsedInArgOrEnv: Do not use ARG or ENV instructions for sensitive data (ENV "AUTH") More info: https://docs.docker.com/go/dockerfile/rule/secrets-used-in-arg-or-env/
ALLOW_STOP=0 \
ALLOW_START=0 \
AUTH=0 \
Expand Down
2 changes: 2 additions & 0 deletions docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ target "socket_proxy" {
name = replace(version, ".", "_")
context = "."
dockerfile = "Dockerfile"
# A cached layer would skip the apk upgrade while the base image is unchanged
no-cache = true
platforms = split(",", PLATFORMS)
args = {
HAPROXY_VERSION = version
Expand Down
7 changes: 6 additions & 1 deletion tests/test_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ def _check_permissions(allowed_calls, forbidden_calls):

def test_default_permissions(proxy_factory):
with proxy_factory() as test_container:
allowed_calls = (("version",),)
allowed_calls = (
("version",),
# Bounded window, so the stream ends instead of following
("events", "--since", "1m", "--until", "1s"),
)
forbidden_calls = (
("pull", "alpine"),
("--rm", "alpine", "--name", test_container),
Expand All @@ -43,6 +47,7 @@ def test_default_permissions(proxy_factory):
def test_container_permissions(proxy_factory):
with proxy_factory(CONTAINERS=1) as test_container:
allowed_calls = [
("ps",),
("logs", test_container),
("inspect", test_container),
]
Expand Down