-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
89 lines (72 loc) · 2.9 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
ARG BB_VERSION=1.2.174
ARG CLOJURE_VERSION=temurin-11-tools-deps-1.11.1.1208-bullseye-slim
ARG LOGSEQ_PUBSPA_VERSION=0.3.1
ARG LOGSEQ_VERSION=0.10.6
FROM babashka/babashka:${BB_VERSION} AS BB
# The build stage
FROM clojure:${CLOJURE_VERSION} AS build
ARG LOGSEQ_PUBSPA_VERSION
ARG LOGSEQ_VERSION
WORKDIR /opt
# Install dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
ca-certificates \
apt-transport-https \
gpg \
build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev \
&& rm -rf /var/lib/apt/lists/* \
&& mkdir -p /usr/local/bin
# Install babashka
COPY --from=BB /opt/babashka-metabom.jar /opt/babashka-metabom.jar
COPY --from=BB /usr/local/bin/bb /usr/local/bin/bb
# install NodeJS & yarn
RUN curl -sL https://deb.nodesource.com/setup_18.x | bash -
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | \
tee /etc/apt/trusted.gpg.d/yarn.gpg && \
echo "deb https://dl.yarnpkg.com/debian/ stable main" | \
tee /etc/apt/sources.list.d/yarn.list && \
apt-get update && apt-get install -y nodejs yarn wget
# Initialize logseq-publish-spa
RUN mkdir -p /opt/logseq-publish-spa && \
wget https://github.com/logseq/publish-spa/archive/refs/tags/v${LOGSEQ_PUBSPA_VERSION}.tar.gz && \
tar -axvf *.tar.gz --directory /opt/logseq-publish-spa --strip-components=1 && \
rm *.tar.gz && \
cd /opt/logseq-publish-spa && yarn install --frozen-lockfile
# Initialize logseq
RUN mkdir -p /opt/logseq-logseq && \
wget https://github.com/logseq/logseq/archive/refs/tags/${LOGSEQ_VERSION}.tar.gz && \
tar -axvf *.tar.gz --directory /opt/logseq-logseq --strip-components=1 && \
rm *.tar.gz && \
cd /opt/logseq-logseq && yarn install --frozen-lockfile && \
yarn gulp:build && clojure -M:cljs release publishing
# Fetching nbb deps
RUN cd /opt/logseq-publish-spa && \
yarn nbb-logseq -e ':fetching-deps'
# The prod stage
FROM clojure:${CLOJURE_VERSION}
ARG NODE_URL
WORKDIR /opt
# install NodeJS & yarn
RUN apt-get update && apt-get install -y --no-install-recommends \
curl ca-certificates apt-transport-https gpg && \
rm -rf /var/lib/apt/lists/* && \
mkdir -p /usr/local/bin
# install NodeJS & yarn
RUN curl -sL https://deb.nodesource.com/setup_18.x | bash -
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | \
tee /etc/apt/trusted.gpg.d/yarn.gpg && \
echo "deb https://dl.yarnpkg.com/debian/ stable main" | \
tee /etc/apt/sources.list.d/yarn.list && \
apt-get update && apt-get install -y nodejs yarn wget && \
rm -rf /var/lib/apt/lists/*
# Copy from build stage
COPY --from=build /opt/logseq-logseq/static /opt/logseq-static
COPY --from=build /opt/logseq-publish-spa /opt/logseq-publish-spa
# Default Environments
ENV PUB_OUT_DIR=/out
ENV PUB_GRAPH_DIR=/graph
# Entrypoint
COPY entrypoint.sh .
RUN chmod +x entrypoint.sh
ENTRYPOINT ["/opt/entrypoint.sh"]