alpine/Dockerfile

46 lines
1.2 KiB
Docker

ARG OS_VERSION=3.21
FROM docker.io/alpine:${OS_VERSION} AS builder
ARG OS_VERSION=3.21
ARG TZ=Asia/Jakarta
# Set User as root
USER root
# Install base dependencies, set timezone to designated timezone
RUN /bin/mkdir /app; \
/usr/sbin/addgroup -g 10000 appuser; \
/usr/sbin/adduser -D -u 10000 -G appuser -s /bin/sh -h /app appuser; \
/bin/chmod 700 /app; \
/bin/chown -R appuser:appuser /app; \
/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 OS_VERSION=3.21
LABEL maintainer="Muhamad Aditya Prima <aprimediet@gmail.com>"
LABEL name="alpine"
LABEL version="${OS_VERSION}"
LABEL distribution-scope="public"
#labels for container catalog
LABEL summary="Alpine Linux ${OS_VERSION} container image"
LABEL description="Provide latest release of Alpine Linux ${OS_VERSION} container base image"
LABEL io.k8s.description="Very small alpine linux container image"
LABEL io.k8s.display-name="Alpine Linux ${OS_VERSION}"
COPY --from=builder / /
USER appuser
WORKDIR /app
CMD ["/bin/sh"]