alpine/Dockerfile

39 lines
1.1 KiB
Docker

ARG ALPINE_VERSION=3.21
FROM alpine:${ALPINE_VERSION} AS builder
ARG ALPINE_VERSION=3.21
ARG TZ=Asia/Jakarta
# Set User as root
USER root
# Install base dependencies, set timezone to designated timezone
RUN --mount=type=cache,target=/var/cache/apk \
/sbin/apk update --no-cache; \
/sbin/apk upgrade --no-cache; \
/sbin/apk add --update --no-cache \
tzdata; \
/bin/echo $TZ > /etc/timezone; \
/bin/cp /usr/share/zoneinfo/$TZ /etc/localtime; \
/sbin/apk del --no-cache tzdata; \
/bin/rm -vrf /var/cache/apk/*;
FROM scratch
ARG ALPINE_VERSION=3.21
LABEL maintainer="Muhamad Aditya Prima <aprimediet@gmail.com>"
LABEL name="alpine"
LABEL version="${ALPINE_VERSION}"
LABEL distribution-scope="public"
#labels for container catalog
LABEL summary="Alpine Linux ${ALPINE_VERSION} container image"
LABEL description="Provide latest release of Alpine Linux ${ALPINE_VERSION} container base image"
LABEL io.k8s.description="Very small alpine linux container image"
LABEL io.k8s.display-name="Alpine Linux ${ALPINE_VERSION}"
COPY --from=builder / /
CMD ["/bin/sh"]