mirror of
https://github.com/h44z/wg-portal
synced 2025-02-26 05:49:14 +00:00
wgquick (apparently) depends on bash and openresolv. Without those packages removing an Interface is impossible and causes an error message to appear in the webui: - No Bash: exec complains about "bash no such file in $PATH" - No openresolv: resolvconf -f -d *interface* returns with error 127 Not having a Shell in the container also makes debugging a lot more annoying. This enables deletion of interfaces in the webui, eases debugging and only adds about 3MB in size.
55 lines
1.4 KiB
Docker
55 lines
1.4 KiB
Docker
# Dockerfile References: https://docs.docker.com/engine/reference/builder/
|
|
# This dockerfile uses a multi-stage build system to reduce the image footprint.
|
|
|
|
######-
|
|
# Start from the latest golang base image as builder image (only used to compile the code)
|
|
######-
|
|
FROM golang:1.21 as builder
|
|
|
|
ARG BUILD_IDENTIFIER
|
|
ENV ENV_BUILD_IDENTIFIER=$BUILD_IDENTIFIER
|
|
|
|
ARG BUILD_VERSION
|
|
ENV ENV_BUILD_VERSION=$BUILD_VERSION
|
|
|
|
# populated by BuildKit
|
|
ARG TARGETPLATFORM
|
|
ENV ENV_TARGETPLATFORM=$TARGETPLATFORM
|
|
|
|
RUN mkdir /build
|
|
|
|
# Copy the source from the current directory to the Working Directory inside the container
|
|
ADD . /build/
|
|
|
|
# Set the Current Working Directory inside the container
|
|
WORKDIR /build
|
|
|
|
# Build the Go app
|
|
RUN echo "Building version '$ENV_BUILD_IDENTIFIER-$ENV_BUILD_VERSION' for platform $ENV_TARGETPLATFORM"; make build
|
|
|
|
######-
|
|
# Here starts the main image
|
|
######-
|
|
FROM alpine:3.19
|
|
|
|
# Install OS-level dependencies
|
|
RUN apk add --no-cache bash openresolv
|
|
|
|
# Setup timezone
|
|
ENV TZ=Europe/Vienna
|
|
|
|
# Copy binaries
|
|
COPY --from=builder /build/dist/wg-portal /app/wg-portal
|
|
|
|
# Set the Current Working Directory inside the container
|
|
WORKDIR /app
|
|
|
|
# by default, the web-portal is reachable on port 8888
|
|
EXPOSE 8888/tcp
|
|
|
|
# the database and config file can be mounted from the host
|
|
VOLUME [ "/app/data", "/app/config" ]
|
|
|
|
# Command to run the executable
|
|
ENTRYPOINT [ "/app/wg-portal" ]
|