aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Dockerfile.base
blob: 894586c3176a7cb0c4af268db329d31a5c62354a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
FROM debian:buster-slim

SHELL ["/bin/bash", "-c"]

ENV DEBIAN_FRONTEND=noninteractive

RUN apt update -yq && \
    apt install -yq --no-install-recommends \
        build-essential \
        ca-certificates wget \
        sudo

# Creating regular user 'developer':
ARG JEKYLL_USER=developer
ENV JEKYLL_USER="$JEKYLL_USER"
RUN addgroup "$JEKYLL_USER" && \
    adduser --disabled-password --gecos "" --ingroup "$JEKYLL_USER" --home "/home/$JEKYLL_USER" "$JEKYLL_USER" && \
    addgroup "$JEKYLL_USER" sudo && \
    echo -e '%sudo ALL=(ALL) NOPASSWD:ALL\nDefaults env_keep += "HOME"' >> /etc/sudoers

USER "$JEKYLL_USER"
ENV PATH="/home/$JEKYLL_USER/.local/bin:$PATH"

ENV MAKEFILE_DIR="/utils"
RUN sudo mkdir -p -- "$MAKEFILE_DIR" && \
    sudo chown -- "$JEKYLL_USER:$JEKYLL_USER" "$MAKEFILE_DIR"
WORKDIR "$MAKEFILE_DIR"

COPY --chown="$JEKYLL_USER:$JEKYLL_USER" ["Makefile", "./"]

RUN make ruby-install && \
    make ruby-install/clean && \
    make ruby && \
    make chruby && \
    sudo make chruby/profile.d && \
    make chruby/clean && \
    make bundler