forked from joshuaavalon/docker-cloudflare
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
68 lines (50 loc) · 1.47 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
ARG BASE_IMAGE=node:16-alpine
ARG OVERLAY_VERSION=v2.2.0.1
FROM $BASE_IMAGE as builder
ARG OVERLAY_VERSION
WORKDIR /app
COPY packages /app/packages/
COPY package.json tsconfig.json package-lock.json /app/
RUN npm ci && \
npm run build --workspaces -- --declaration false --sourceMap false && \
rm -rf packages/*/lib/__tests__
RUN mkdir /packages && \
cp --parents -r packages/*/lib / && \
cp --parents packages/*/package.json /
FROM $BASE_IMAGE
ARG OVERLAY_VERSION
ARG OVERLAY_ARCH
ARG TARGETARCH
WORKDIR /app
ENV CLOUDFLARE_CONFIG=/app/config.yaml
ENV PUID=1001
ENV PGID=1001
ENV NODE_ENV=production
ENV CRON='*/5 * * * *'
COPY --from=builder /packages /app/packages/
COPY package.json package-lock.json /app/
COPY docker/root/ /
RUN chmod +x /app/cloudflare.sh
RUN apk add --no-cache bash
SHELL ["/bin/bash", "-c"]
RUN apk add --no-cache --virtual=build-dependencies curl tar && \
if [[ "$TARGETARCH" == arm* ]]; then OVERLAY_ARCH=arm; else OVERLAY_ARCH="$TARGETARCH"; fi && \
curl -L "https://github.com/just-containers/s6-overlay/releases/download/${OVERLAY_VERSION}/s6-overlay-${OVERLAY_ARCH}.tar.gz" | tar xz -C / && \
apk del --purge build-dependencies
RUN npm install -g npm@latest && \
npm ci
RUN apk add --no-cache shadow && \
useradd -u 1001 -U -d /config -s /bin/false abc && \
usermod -G users abc
ENV ZONE=
ENV HOST=
ENV EMAIL=
ENV API=
ENV TTL=
ENV PROXY=
ENV DEBUG=
ENV FORCE_CREATE=
ENV RUNONCE=
ENV IPV6=
ENTRYPOINT ["/init"]
CMD []