mirror of
https://github.com/donaldzou/WGDashboard.git
synced 2025-09-02 10:01:13 +00:00
Docker 2 Stage
This commit is contained in:
34
Dockerfile
34
Dockerfile
@@ -1,25 +1,35 @@
|
||||
# Pull from small Debian stable image.
|
||||
FROM alpine:latest
|
||||
FROM alpine:latest AS builder
|
||||
|
||||
LABEL maintainer="dselen@nerthus.nl"
|
||||
ENV PYTHONPATH="/usr/lib/python3.12/site-packages"
|
||||
|
||||
WORKDIR /opt/wireguarddashboard/src
|
||||
|
||||
RUN apk update && \
|
||||
apk add --no-cache sudo gcc musl-dev linux-headers && \
|
||||
apk add --no-cache wireguard-tools && \
|
||||
apk add --no-cache iptables ip6tables && \
|
||||
mkdir /opt/wireguarddashboard/src/master-key
|
||||
|
||||
apk add --no-cache sudo gcc musl-dev rust cargo linux-headers
|
||||
|
||||
COPY ./docker/alpine/builder.sh /opt/wireguarddashboard/src/
|
||||
COPY ./docker/alpine/requirements.txt /opt/wireguarddashboard/src/
|
||||
RUN chmod u+x /opt/wireguarddashboard/src/builder.sh
|
||||
RUN /opt/wireguarddashboard/src/builder.sh
|
||||
|
||||
|
||||
FROM alpine:latest
|
||||
WORKDIR /opt/wireguarddashboard/src
|
||||
|
||||
COPY ./src /opt/wireguarddashboard/src/
|
||||
COPY --from=builder /opt/wireguarddashboard/src/venv /opt/wireguarddashboard/src/venv
|
||||
COPY --from=builder /opt/wireguarddashboard/src/log /opt/wireguarddashboard/src/log/
|
||||
COPY ./docker/alpine/entrypoint.sh /opt/wireguarddashboard/src/
|
||||
#COPY ./docker/alpine/wgd.sh /opt/wireguarddashboard/src/
|
||||
#COPY ./docker/alpine/requirements.txt /opt/wireguarddashboard/src/
|
||||
|
||||
RUN chmod u+x /opt/wireguarddashboard/src/entrypoint.sh
|
||||
COPY ./docker/alpine/wgd.sh /opt/wireguarddashboard/src/
|
||||
|
||||
|
||||
# Defining a way for Docker to check the health of the container. In this case: checking the login URL.
|
||||
|
||||
RUN apk update && \
|
||||
apk add --no-cache wireguard-tools sudo && \
|
||||
apk add --no-cache iptables ip6tables && \
|
||||
chmod u+x /opt/wireguarddashboard/src/entrypoint.sh
|
||||
|
||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 CMD curl -f http://localhost:10086/signin || exit 1
|
||||
|
||||
ENTRYPOINT ["/opt/wireguarddashboard/src/entrypoint.sh"]
|
Reference in New Issue
Block a user