-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
37 lines (33 loc) · 1.31 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
FROM ubuntu:23.04 as builder
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update
RUN apt-get install -y --no-install-recommends nftables iproute2 netcat-traditional inetutils-ping net-tools nano ca-certificates git curl
RUN mkdir /code
WORKDIR /code
ARG TARGETARCH
RUN curl -O https://dl.google.com/go/go1.22.6.linux-${TARGETARCH}.tar.gz
RUN rm -rf /usr/local/go && tar -C /usr/local -xzf go1.22.6.linux-${TARGETARCH}.tar.gz
ENV PATH="/usr/local/go/bin:$PATH"
COPY code/ /code/
ARG USE_TMPFS=true
RUN --mount=type=tmpfs,target=/tmpfs \
[ "$USE_TMPFS" = "true" ] && ln -s /tmpfs /root/go; \
go build -ldflags "-s -w" -o /main /code/main.go
# build ui
FROM node:18 as builder-ui
WORKDIR /app
COPY frontend ./
ARG USE_TMPFS=true
RUN --mount=type=tmpfs,target=/tmpfs \
[ "$USE_TMPFS" = "true" ] && \
mkdir /tmpfs/cache /tmpfs/node_modules && \
ln -s /tmpfs/node_modules /app/node_modules && \
ln -s /tmpfs/cache /usr/local/share/.cache; \
yarn install --network-timeout 86400000 && yarn run build
FROM mitmproxy/mitmproxy
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends curl nftables haproxy && rm -rf /var/lib/apt/lists/*
COPY scripts /scripts
COPY --from=builder /main /
COPY --from=builder-ui /app/build /ui/
ENTRYPOINT ["/scripts/startup.sh"]