diff --git a/Dockerfile b/Dockerfile index a70c9b5..8ebd9f4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ ARG CONTEXT=prod -FROM caddy:2.3.0-alpine as base +FROM caddy:2.3.0-alpine AS base ## Setup ARG CONTEXT @@ -30,17 +30,17 @@ CMD ["./command.sh"] # Development Image -FROM base as dev +FROM base AS dev ENV ENABLE_LOCAL_HTTPS=1 # Testing Image -FROM base as tests +FROM base AS tests # Production Image -FROM base as prod +FROM base AS prod # Add appuser RUN adduser --system --no-create-home appuser && \ diff --git a/Makefile b/Makefile index 28b2004..0b7910e 100644 --- a/Makefile +++ b/Makefile @@ -1,14 +1,21 @@ -SERVICE=proxy +override SERVICE=proxy + +# Build images for different contexts build-prod: - docker build ./ --tag "openslides-$(SERVICE)" --build-arg CONTEXT="prod" --target "prod" + docker build ./ $(ARGS) --tag "openslides-$(SERVICE)" --build-arg CONTEXT="prod" --target "prod" build-dev: ./make-localhost-cert.sh - docker build ./ --tag "openslides-$(SERVICE)-dev" --build-arg CONTEXT="dev" --target "dev" + docker build ./ $(ARGS) --tag "openslides-$(SERVICE)-dev" --build-arg CONTEXT="dev" --target "dev" + +build-tests: + docker build ./ $(ARGS) --tag "openslides-$(SERVICE)-tests" --build-arg CONTEXT="tests" --target "tests" -build-test: - docker build ./ --tag "openslides-$(SERVICE)-tests" --build-arg CONTEXT="tests" --target "tests" +# Tests run-tests: - echo "Proxy has no tests" + bash dev/run-tests.sh + +lint: + bash dev/run-lint.sh -l diff --git a/dev/command.sh b/dev/command.sh index ec45872..bcd5658 100644 --- a/dev/command.sh +++ b/dev/command.sh @@ -1,4 +1,4 @@ #!/bin/sh # Same command for all contexts -caddy run --config /etc/caddy/config.json \ No newline at end of file +caddy run --config /etc/caddy/config.json diff --git a/dev/run-lint.sh b/dev/run-lint.sh new file mode 100644 index 0000000..99dcf00 --- /dev/null +++ b/dev/run-lint.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +echo "########################################################################" +echo "####################### Proxy has no linters ###########################" +echo "########################################################################" diff --git a/dev/run-tests.sh b/dev/run-tests.sh index 8c612be..43060af 100644 --- a/dev/run-tests.sh +++ b/dev/run-tests.sh @@ -1,5 +1,13 @@ #!/bin/bash +set -e + echo "########################################################################" echo "###################### Proxy has no tests ##############################" echo "########################################################################" + +# Setup +LOCAL_PWD=$(dirname "$0") + +# Linters +bash "$LOCAL_PWD"/run-lint.sh