-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
38 lines (34 loc) · 1.37 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
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.20.linux-${TARGETARCH}.tar.gz
RUN rm -rf /usr/local/go && tar -C /usr/local -xzf go1.20.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 /sample_plugin /code/sample_plugin.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 bundle
# link to main image
FROM ghcr.io/spr-networks/container_template:latest
ENV DEBIAN_FRONTEND=noninteractive
#RUN apt-get update && apt-get install -y --no-install-recommends tcpdump && rm -rf /var/lib/apt/lists/*
COPY scripts /scripts/
COPY --from=builder /sample_plugin /
COPY --from=builder-ui /app/build/ /ui/
ENTRYPOINT ["/scripts/startup.sh"]