-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
47 lines (36 loc) · 1.42 KB
/
Dockerfile
File metadata and controls
47 lines (36 loc) · 1.42 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 debian:buster AS base
# This code is adapted from:
# https://gist.github.com/dergachev/8441335#gistcomment-2007024
ENV DEBIAN_FRONTEND=noninteractive
## When installed using `apt install squid-deb-proxy`, it listens on port 8000 on the host by dfault.
## Override this variable with "" can disable apt proxy.
ARG APT_PROXY_PORT=8000
COPY detect-apt-proxy.sh /tmp
RUN /tmp/detect-apt-proxy.sh ${APT_PROXY_PORT}
# Install dependencies
RUN apt-get update && apt-get dist-upgrade -y
RUN apt-get install -y --no-install-recommends nodejs npm git apt-utils coreutils python3
# Install git-cache-http-server
RUN npm install -g git-cache-http-server
# Clean apt-proxy
COPY remove-apt-proxy.sh /tmp/
RUN /tmp/remove-apt-proxy.sh
# Clean apt-get cache
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Clean npm cache
RUN npm cache clean --force
# Remove useless package
RUN apt-get remove -y apt-utils npm
RUN apt-get autoremove -y
# Config git to tradeoff cache size over decompression time
RUN git config --global core.compression 9
RUN git config --global core.looseCompression 9
RUN git config --global pack.compression 9
COPY main.py /root/
# Workaround the problem that multi-stage build cannot copy files between stages when
# usernamespace is enabled.
RUN chown -R root:root $(ls / | grep -v -e "dev" -e "sys" -e "tmp" -e "proc") || echo
FROM debian:buster
COPY --from=base / /
EXPOSE 8080
CMD ["/root/main.py"]