forked from spq/pkappa2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
42 lines (33 loc) · 1.18 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
# Build frontend
FROM node:20-alpine AS frontend_builder
RUN apk add --no-cache git
WORKDIR /app
COPY ./web/ /app
RUN yarn install --frozen-lockfile && yarn build
# Build backend
FROM golang:1.22 AS backend_builder
WORKDIR /app
RUN apt-get update && apt-get install -y --no-install-recommends libpcap-dev && rm -rf /var/lib/apt/lists/*
COPY ./go.mod ./go.sum ./
RUN go mod download
COPY ./ ./
COPY --from=frontend_builder /app/dist ./web/dist
RUN go build -o ./bin/pkappa2 ./cmd/pkappa2/main.go
# Run
FROM ubuntu:latest
WORKDIR /app
RUN apt-get update && apt-get install -y --no-install-recommends libpcap0.8 python3 python3-dev python3-pip && rm -rf /var/lib/apt/lists/*
COPY converters/pkappa2lib/requirements.txt requirements.txt
RUN python3 -m pip install --break-system-packages --upgrade -r requirements.txt
COPY --from=backend_builder /app/bin/pkappa2 ./pkappa2
COPY --from=backend_builder /app/web/dist ./web/dist
RUN adduser pkappa2
RUN mkdir /data && chown pkappa2:pkappa2 /data
RUN mkdir /app/converters && chown pkappa2:pkappa2 /app/converters
USER pkappa2
EXPOSE 8080
VOLUME /data
VOLUME /app/converters
ENV PKAPPA2_BASE_DIR="/data"
ENV PKAPPA2_ADDRESS=":8080"
ENTRYPOINT [ "/app/pkappa2" ]