Skip to content

Commit

Permalink
Add alpine/apk option
Browse files Browse the repository at this point in the history
  • Loading branch information
jason-fox committed Jan 6, 2022
1 parent fd195cd commit 571c4cf
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
7 changes: 4 additions & 3 deletions extras/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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; \
Expand Down Expand Up @@ -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
Expand Down
11 changes: 11 additions & 0 deletions extras/docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down

0 comments on commit 571c4cf

Please sign in to comment.