-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
57 lines (40 loc) · 1.71 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
# ------------- Base image used for both build targets -------------
FROM clfoundation/sbcl:latest AS base
ARG SITENAME
RUN apt-get update \
&& apt-get install -y libev4
# Dummy user to specify home directory for Quicklisp install
RUN addgroup "${SITENAME}-user" \
&& adduser --ingroup "${SITENAME}-user" --home /home/site --disabled-password "${SITENAME}-user"
USER "${SITENAME}-user"
ENV QUICKLISP_ADD_TO_INIT_FILE=true
RUN /usr/local/bin/install-quicklisp
WORKDIR /home/site/quicklisp/local-projects/"${SITENAME}"
USER root
# Download tailwind.css executable
RUN curl -sLO https://github.com/tailwindlabs/tailwindcss/releases/latest/download/tailwindcss-linux-x64 \
&& chmod +x tailwindcss-linux-x64 \
&& mv tailwindcss-linux-x64 tailwindcss
COPY . .
# ------------- Development image -------------
FROM base as dev
# System user to launch app
RUN addgroup --system "${SITENAME}" \
&& adduser --ingroup "${SITENAME}" --shell /bin/false --home /home/site --disabled-password "${SITENAME}"
RUN chown -R "${SITENAME}:${SITENAME}" /home/site
USER "${SITENAME}"
ENTRYPOINT ["sbcl", "--load", "start.lisp"]
CMD ["--bind", "0.0.0.0", "--port", "3000", "--swank-port", "4005", "--debug"]
EXPOSE 3000 4005
# ------------- Production image -------------
FROM base as prod
RUN ./tailwindcss -i ./public/styles.css -o ./public/layout.css --minify \
&& rm tailwindcss
# System user to launch app
RUN addgroup --system "${SITENAME}" \
&& adduser --ingroup "${SITENAME}" --shell /bin/false --home /home/site --disabled-password "${SITENAME}"
RUN chown -R "${SITENAME}:${SITENAME}" /home/site
USER "${SITENAME}"
ENTRYPOINT ["sbcl", "--load", "start.lisp"]
CMD ["--bind", "0.0.0.0", "--port", "3000"]
EXPOSE 3000