-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile
45 lines (36 loc) · 1.16 KB
/
Dockerfile
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
41
42
43
44
45
FROM crunchgeek/composer:7.2 as composer
ARG TOKEN
ENV TOKEN ${TOKEN}
COPY . /src
WORKDIR /src
ENV COMPOSER_ALLOW_SUPERUSER 1
#RUN echo "{\"github-oauth\": {\"github.com\": \"$TOKEN\"}}" > /tmp/auth.json
RUN composer install --no-interaction --no-dev --prefer-dist
### compile js & css assets
FROM node:8.15 as node
WORKDIR /node
COPY --from=composer /src /node
RUN npm i && \
npm run production
RUN rm -rf /node/node_modules
### build app container
FROM alpine:3.5
WORKDIR /app
COPY .kubernetes/infrastructure /config
COPY --from=node /node /app
# set requirement privileges
RUN chown -R 9000:9000 storage && \
chown -R 9000:9000 bootstrap/cache && \
chmod -R ug+rwx bootstrap/cache && \
chgrp -R 9000 bootstrap/cache && \
chmod +x artisan && \
chmod +x /config/provision.sh
# create init script
RUN echo '#!/bin/sh' > /init.sh && \
echo 'echo "app init started!"' >> /init.sh && \
echo 'cp -rp /app/* /src' >> /init.sh && \
echo 'cp -rp /config/* /cfg' >> /init.sh && \
echo 'touch db/database.sqlite' >> /init.sh && \
echo 'echo "app init completed!"' >> /init.sh && \
chmod +x /init.sh
CMD [ "sh", "-c", "/init.sh" ]