@@ 1,40 1,43 @@
-FROM alpine:3
-RUN apk add --no-cache elixir nginx git rust cargo nodejs npm tzdata
-RUN ln -s /usr/share/zoneinfo/Europe/Amsterdam /etc/localtime
-COPY nginx.conf /etc/nginx/nginx.conf
-
-# setup folders
-RUN mkdir -p /data/www
-RUN adduser -D -g 'www' www
-RUN chown -R www:www /var/lib/nginx
+# [[ META-BUILDER ]]
-# build fxg
-WORKDIR "/usr/local/fxg"
-COPY fxg .
-RUN cargo build --release
-RUN cp target/release/fxg /usr/local/bin
+FROM alpine:3 AS kethel
+RUN apk add --no-cache elixir git tzdata nodejs npm
+RUN ln -s /usr/share/zoneinfo/Europe/Amsterdam /etc/localtime
# fetch deps
WORKDIR "/usr/local/app"
COPY pull-hljs.sh .
RUN ./pull-hljs.sh
WORKDIR "/usr/local/app/kethel"
-COPY kethel/mix.exs kethel/mix.lock kethel/package.json kethel/package-lock.json ./
+COPY kethel ./
RUN npm i
# build www.m1kadev.nl
WORKDIR "/usr/local/app"
-COPY . .
+
+COPY rss ./rss
+COPY static ./static
+COPY favicon.ico .
+
+COPY templates ./templates
+COPY bricks ./bricks
+COPY styles ./styles
+
+COPY scripts ./scripts
+COPY pages ./pages
+COPY thoughts ./thoughts
+
+COPY .git ./
+
WORKDIR "/usr/local/app/kethel"
RUN mix deps.get
RUN mix compile.rambo
+
RUN mix run main.exs -- ..
WORKDIR "/usr/local/app"
-RUN cp -r build/* /data/www
-WORKDIR "/data/www"
-RUN chown -R www:www /data/www
-RUN chmod -R 744 /data/www
+# [[ SERVER ]]
+FROM nginx:mainline AS server
-# serve www.m1kadev.nl
-CMD [ "nginx", "-c", "/etc/nginx/nginx.conf" ]
+COPY --from=kethel /usr/local/app/build /usr/share/nginx/html
+COPY nginx.conf /etc/nginx/nginx.conf