refactor: dockerfiles versioning using new SERVER_VERSION env
Diff
docker/alpine/Dockerfile | 9 +++++++--
docker/alpine/tmpl.Dockerfile | 28 ----------------------------
docker/scratch/Dockerfile | 9 +++++++--
docker/scratch/tmpl.Dockerfile | 18 ------------------
docker/version.sh | 37 -------------------------------------
5 files changed, 14 insertions(+), 87 deletions(-)
@@ -1,6 +1,11 @@
FROM alpine:3.11
LABEL maintainer="Jose Quintana <joseluisq.net>"
ARG SERVER_VERSION=0.0.0
ENV SERVER_VERSION=${SERVER_VERSION}
LABEL version="${SERVER_VERSION}" \
description="A blazing fast static files-serving web server powered by Rust Iron." \
maintainer="Jose Quintana <joseluisq.net>"
RUN apk --no-cache add ca-certificates tzdata
RUN set -ex; \
@@ -24,5 +29,5 @@ LABEL org.opencontainers.image.vendor="Jose Quintana" \
org.opencontainers.image.url="https://github.com/joseluisq/static-web-server" \
org.opencontainers.image.title="Static Web Server" \
org.opencontainers.image.description="A blazing fast static files-serving web server powered by Rust Iron." \
org.opencontainers.image.version="v1.10.0" \
org.opencontainers.image.version="${SERVER_VERSION}" \
org.opencontainers.image.documentation="https://github.com/joseluisq/static-web-server"
@@ -1,28 +0,0 @@
FROM alpine:$ALPINE_VERSION
LABEL maintainer="Jose Quintana <joseluisq.net>"
RUN apk --no-cache add ca-certificates tzdata
RUN set -ex; \
apkArch="$(apk --print-arch)"; \
case "$apkArch" in \
armhf) arch='armv6' ;; \
aarch64) arch='arm64' ;; \
x86_64) arch='amd64' ;; \
*) echo >&2 "error: unsupported architecture: $apkArch"; exit 1 ;; \
esac;
COPY ./docker/alpine/entrypoint.sh /
COPY ./bin/static-web-server /usr/local/bin/
COPY ./public /public
EXPOSE 80
ENTRYPOINT ["/entrypoint.sh"]
CMD ["static-web-server"]
LABEL org.opencontainers.image.vendor="Jose Quintana" \
org.opencontainers.image.url="https://github.com/joseluisq/static-web-server" \
org.opencontainers.image.title="Static Web Server" \
org.opencontainers.image.description="A blazing fast static files-serving web server powered by Rust Iron." \
org.opencontainers.image.version="$VERSION" \
org.opencontainers.image.documentation="https://github.com/joseluisq/static-web-server"
@@ -1,6 +1,11 @@
FROM scratch
LABEL maintainer="Jose Quintana <joseluisq.net>"
ARG SERVER_VERSION=0.0.0
ENV SERVER_VERSION=${SERVER_VERSION}
LABEL version="${SERVER_VERSION}" \
description="A blazing fast static files-serving web server powered by Rust Iron." \
maintainer="Jose Quintana <joseluisq.net>"
COPY ./bin/static-web-server /
COPY ./public /public
@@ -14,5 +19,5 @@ LABEL org.opencontainers.image.vendor="Jose Quintana" \
org.opencontainers.image.url="https://github.com/joseluisq/static-web-server" \
org.opencontainers.image.title="Static Web Server" \
org.opencontainers.image.description="A blazing fast static files-serving web server powered by Rust Iron." \
org.opencontainers.image.version="v1.10.0" \
org.opencontainers.image.version="${SERVER_VERSION}" \
org.opencontainers.image.documentation="https://github.com/joseluisq/static-web-server"
@@ -1,18 +0,0 @@
FROM scratch
LABEL maintainer="Jose Quintana <joseluisq.net>"
COPY ./bin/static-web-server /
COPY ./public /public
EXPOSE 80
VOLUME ["/public"]
ENTRYPOINT ["/static-web-server"]
LABEL org.opencontainers.image.vendor="Jose Quintana" \
org.opencontainers.image.url="https://github.com/joseluisq/static-web-server" \
org.opencontainers.image.title="Static Web Server" \
org.opencontainers.image.description="A blazing fast static files-serving web server powered by Rust Iron." \
org.opencontainers.image.version="$VERSION" \
org.opencontainers.image.documentation="https://github.com/joseluisq/static-web-server"
@@ -1,37 +0,0 @@
set -e
set -u
LATEST_TAG=$1
BASE_PATH="$(pwd)/docker"
if [ $# -eq 0 ]; then
echo "Usage: ./version.sh <tag or branch>"
exit
fi
export VERSION=$LATEST_TAG
export ALPINE_VERSION=3.11
PLATFORMS=(
"alpine"
"scratch"
)
for PLATFORM in "${PLATFORMS[@]}"; do
PLATFORM_DIR="${BASE_PATH}/${PLATFORM}"
if [ ! -d "$PLATFORM_DIR" ]; then
echo "Directory no found for \"${PLATFORM_DIR}\""
exit 1
fi
echo "Generating Dockerfile for platform \"${PLATFORM}\""
rm -rf "${PLATFORM_DIR}/Dockerfile"
envsubst \$ALPINE_VERSION,\$VERSION <"${PLATFORM_DIR}/tmpl.Dockerfile" >"${PLATFORM_DIR}/Dockerfile"
done
echo "All Dockerfiles were updated!"