Dockerfile 3.29 KB
Newer Older
1
FROM gitlab/gitlab-runner:ubuntu
Michał 'rysiek' Woźniak's avatar
Michał 'rysiek' Woźniak committed
2 3 4
MAINTAINER Michał "rysiek" Woźniak <rysiek@occrp.org>

#
5
# a Gitlab CI container to be used with Jekyll static site generator
Michał 'rysiek' Woźniak's avatar
Michał 'rysiek' Woźniak committed
6 7 8 9
#

# environment
ENV DEBIAN_FRONTEND=noninteractive 
10

11 12 13 14
# uid and gid of the gitlab-runner user
ARG GITLAB_RUNNER_UID=999
ARG GITLAB_RUNNER_GID=999

15 16 17
# open files limit needs to be bumped
COPY open-file-limit.conf /etc/security/limits.d/

18 19 20
# and let's modify the group and the user
RUN groupmod --gid ${GITLAB_RUNNER_GID} gitlab-runner \
    && usermod --uid "${GITLAB_RUNNER_UID}" gitlab-runner
21

22 23
# we need this to be able to handle the node repo setup
RUN DEBIAN_FRONTEND=noninteractive apt-get -q update && \
24 25 26 27
        apt-get -q -y --no-install-recommends install \
            gnupg \
            apt-transport-https \
            ca-certificates \
28
            locales \
29 30 31
            lsb-release && \
        apt-get -q clean && \
        apt-get -q -y autoremove && \
32 33
        rm -rf /var/lib/apt/lists/*

34 35 36 37 38 39 40
# need en_US.UTF-8 locale for SASS to handle UTF-8 characters in CSS
# http://code.dblock.org/2011/06/09/compass-invalid-us-ascii-character-xe2.html
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
RUN locale-gen en_US.UTF-8

41 42 43 44 45
# add the node repo key
COPY node-repo-key.asc /tmp/node-repo-key.asc
RUN apt-key add /tmp/node-repo-key.asc

# add the node repo
46
RUN echo "deb https://deb.nodesource.com/node_8.x xenial main\ndeb-src https://deb.nodesource.com/node_8.x xenial main\n" > /etc/apt/sources.list.d/node_8.x.list
47 48 49 50

# adding additional repository keys from build args
ARG ADD_REPOSITORY_KEYS=
RUN if [ "$ADD_REPOSITORY_KEYS" != "" ]; then \
51 52
        echo "$ADD_REPOSITORY_KEYS" | sed -e 's/^[[:space:]]*//' | apt-key add - ; \
    fi
53

54
# adding repositories from build args
55 56
ARG ADD_REPOSITORIES=
RUN if [ "$ADD_REPOSITORIES" != "" ]; then \
Michał 'rysiek' Woźniak's avatar
bugfix  
Michał 'rysiek' Woźniak committed
57
        echo "$ADD_REPOSITORIES" | sed -e 's/^[[:space:]]*//' > /etc/apt/sources.list.d/added-from-docker-build-arg.list ; \
58 59
    fi

Michał 'rysiek' Woźniak's avatar
fixed  
Michał 'rysiek' Woźniak committed
60
# Ruby and requirements
Michał 'rysiek' Woźniak's avatar
Michał 'rysiek' Woźniak committed
61 62 63 64
RUN apt-get update && \
    apt-get install -y --no-install-recommends \
        make \
        gcc \
65
        g++ \
Michał 'rysiek' Woźniak's avatar
fixed  
Michał 'rysiek' Woźniak committed
66 67 68 69
        libc-dev-bin \
        libc6-dev \
        linux-libc-dev \
        libc6 \
70
        software-properties-common \
71 72 73
        rsync \
        imagemagick \
        nodejs && \
74
    rm -rf /var/lib/apt/lists/*
75

76 77 78
RUN apt-get update && \
    apt-get install -y --no-install-recommends npm

79 80
# npm's self-signed CA is no more
# https://blog.npmjs.org/post/78085451721/npms-self-signed-certificate-is-no-more
Michał 'rysiek' Woźniak's avatar
bugfix  
Michał 'rysiek' Woźniak committed
81
RUN npm config -g set ca ""
82

83 84 85 86
# need a newer Ruby
RUN add-apt-repository ppa:brightbox/ruby-ng && \
    apt-get update && \
    apt-get install -y --no-install-recommends \
87 88
        ruby2.6 \
        ruby2.6-dev && \
89
    rm -rf /var/lib/apt/lists/*
90

91 92 93 94 95 96 97 98
# we might need to install some packages, but doing this in the entrypoint doesn't make any sense
ARG INSTALL_PACKAGES=
RUN if [ "$INSTALL_PACKAGES" != "" ]; then \
        export DEBIAN_FRONTEND=noninteractive && apt-get update && apt-get install -y \
            $INSTALL_PACKAGES \
            --no-install-recommends && \
        rm -rf /var/lib/apt/lists/* ; \
    fi
99

100
# Jekyll-related requirements
101
RUN gem2.6 install jekyll:'<4' bundler:'<2'
102
RUN /usr/bin/npm install bower -g
Michał 'rysiek' Woźniak's avatar
Michał 'rysiek' Woźniak committed
103

104 105 106 107
# copy in the entrypoint script
COPY entrypoint /
RUN chmod +x /entrypoint

108
VOLUME ["/etc/gitlab-runner", "/home/gitlab-runner", "/output"]