FROM alpine:latest
USER root
LABEL maintainer="Josephine Pfeiffer <jpfeiffe@redhat.com>"

ARG VERSION=latest
ENV VERSION=$VERSION

COPY setup.sh .

RUN apk add --no-cache bash

RUN set -x && \
    /bin/bash setup.sh --version $VERSION

RUN adduser crc-user sudo

RUN echo "crc-user:mypassword" | chpasswd && \
    echo "crc-user ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/crc-user && chmod 440 /etc/sudoers.d/crc-user && \
    chown root:root /etc/sudoers.d/crc-user

USER crc-user
