aboutsummaryrefslogtreecommitdiff
path: root/Dockerfile
blob: b009dfa3dcfa27c39df28dce6512e5f188e56ea0 (plain)
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
38
39
40
# Build command:
# hetmml/rooster:stable
#   docker build . --build-arg=SCHOOL=metis --build-arg=SCHOOL_LEVEL=havo-vwo -t hetmml/rooster:stable
# hetmml/rooster:stable-mavo
#   docker build . --build-arg=SCHOOL=metis --build-arg=SCHOOL_LEVEL=mavo -t hetmml/rooster:stable-mavo
# hetmml/rooster:stable-kiemm
#   docker build . --build-arg=SCHOOL=kiemm --build-arg=SCHOOL_LEVEL=mavo -t hetmml/rooster:stable-kiemm
FROM ubuntu
ARG SCHOOL=metis
ARG SCHOOL_LEVEL=havo-vwo

RUN apt-get update
RUN apt-get install -y curl build-essential apt-transport-https
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash -
RUN apt-get install -y nodejs yarn

COPY . /var/www
WORKDIR /var/www

RUN npm install
RUN if [ "$SCHOOL" = "kiemm" ]                                      ;\
    then if [ "$SCHOOL_LEVEL" = "mavo" ]                            ;\
         then npm run build-kiemm                                   ;\
         else echo "SCHOOL_LEVEL must be mavo is SCHOOL is kiemm"   ;\
              exit 1                                                ;\
         fi                                                         ;\
    else if [ "$SCHOOL_LEVEL" = "mavo" ]                            ;\
         then npm run build-mavo                                    ;\
         else npm run build                                         ;\
         fi                                                         ;\
    fi

ENV PORT=80
ENV SCHOOL=$SCHOOL
ENV SCHOOL_LEVEL=$SCHOOL_LEVEL
EXPOSE 80

CMD yarn start