-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
47 lines (33 loc) · 1.23 KB
/
Dockerfile
File metadata and controls
47 lines (33 loc) · 1.23 KB
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
FROM docker.io/alpine:3.15.3
# glibc is required for deno
FROM docker.io/frolvlad/alpine-glibc:alpine-3.15
ARG TINI_VERSION=v0.19.0
ARG DENO_VERSION=1.20.6
RUN apk add --update gnupg make
# A small init system
# Not sure if it's needed or not
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini
RUN chmod +x /tini
ENTRYPOINT ["/tini", "--"]
# Download deno
COPY --from=docker.io/denoland/deno:bin-${DENO_VERSION} /deno /bin/deno
EXPOSE 8080
# Prefer not to run as root.
RUN addgroup --gid 1000 backend \
&& adduser --uid 1000 --disabled-password backend --ingroup backend \
&& mkdir /deno-dir/ \
&& chown -R backend:backend /deno-dir/
ENV DENO_DIR /deno-dir/
ENV DENO_INSTALL_ROOT /usr/local
WORKDIR /app
RUN chown -R backend:backend /app/
USER backend
# Cache the dependencies as a layer (the following two steps are re-run only when deps.ts is modified).
# Ideally cache deps.ts will download and compile _all_ external files used in main.ts.
COPY deps.ts .
RUN deno cache --no-check deps.ts
# These steps will be re-run upon each file change in your working directory:
ADD . .
# Compile the main app so that it doesn't need to be compiled each startup/entry.
RUN deno cache --no-check main.ts
CMD ["make", "run"]