diff --git a/extras/docker/Dockerfile b/extras/docker/Dockerfile index 4a3f7dd..55b3b80 100644 --- a/extras/docker/Dockerfile +++ b/extras/docker/Dockerfile @@ -36,9 +36,6 @@ ARG DOWNLOAD ARG SOURCE_BRANCH ARG PACKAGE_MANAGER -SHELL ["/bin/bash", "-o", "pipefail", "-c"] - - # hadolint ignore=DL3002 USER root # Ensure that the chosen package manger is supported by this Dockerfile @@ -53,6 +50,9 @@ RUN \ echo -e "\033[0;33mWARNING: Overriding default package manager. Using \"${PACKAGE_MANAGER}\" .\033[0m"; \ yum install -y unzip; \ yum clean all; \ + elif [ "${PACKAGE_MANAGER}" = "apk" ]; then \ + echo -e "\033[0;33mWARNING: Overriding default package manager. Using \"${PACKAGE_MANAGER}\" .\033[0m"; \ + apk --no-cache --update-cache add gcc python3 python3-dev py-pip build-base wget curl; \ else \ echo -e "\033[0;31mERROR: Package Manager \"${PACKAGE_MANAGER}\" not supported.\033[0m"; \ exit 1; \ @@ -178,6 +178,7 @@ LABEL "org.nodejs.version"=${NODE_VERSION} COPY --from=builder /opt/fiware-pep-proxy /opt/fiware-pep-proxy WORKDIR /opt/fiware-pep-proxy +# Node by default, use 406 for Alpine, 1001 for UBI, USER ${USER} ENV NODE_ENV=production # Ports used by application diff --git a/extras/docker/README.md b/extras/docker/README.md index 1080114..d1e9eb1 100644 --- a/extras/docker/README.md +++ b/extras/docker/README.md @@ -101,6 +101,17 @@ sudo docker build -t pep-proxy \ --build-arg USER=1001 . --no-cache ``` +To create a container based on [Alpine Linux](https://alpinelinux.org/about/) add `BUILDER`, `DISTRO`, `PACKAGE_MANAGER` +and `USER` parameters as shown: + +```console +docker build -t pep-proxy \ + --build-arg BUILDER=node:16-alpine \ + --build-arg DISTRO=node:16-alpine \ + --build-arg PACKAGE_MANAGER=apk . \ + --build-arg USER=406 . --no-cache +``` + Currently, the following `--build-arg` parameters are supported: | Parameter | Description |