FROM alpine:3.14

RUN echo hosts: dns files > /etc/nsswitch.conf
RUN apk add --no-cache --update \
		sudo tzdata zsh

RUN adduser -s /bin/zsh -D ambrose -u 1000 \
	&& echo '' >> /etc/sudoers \
	&& echo '## No password sudo' >> /etc/sudoers \
	&& echo 'ambrose ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers

WORKDIR /home/ambrose
COPY --chown=ambrose:ambrose . .
RUN chown ambrose:ambrose /home/ambrose \
	&& chmod go-rwx .gnupg

USER ambrose

RUN ./.config/yadm/bootstrap rootzsh desktop

LABEL org.opencontainers.image.title="environment"
LABEL org.opencontainers.image.url="https://github.com/serverwentdown/env"
LABEL org.opencontainers.image.source="https://github.com/serverwentdown/env.git"
LABEL org.opencontainers.image.authors="Ambrose Chua"

CMD ["/bin/zsh", "-l"]

# vim: set ft=dockerfile:
