diff --git a/Dockerfile b/Dockerfile index 855dc28..bc59940 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,35 +1,43 @@ FROM alpine:latest -# Install base tools without tshark +# Install base tools RUN apk update && apk add --no-cache \ - bash \ - curl \ - wget \ - tar \ - traceroute \ - openssl \ - iperf3 \ - busybox-extras \ - nmap \ - netcat-openbsd \ - tcpdump \ - mtr \ - socat \ - bind-tools \ - iproute2 \ - openssh-client \ - python3 \ - procps \ - coreutils \ - mongodb-tools \ - postgresql15-client \ - py3-flask - -# Install Go 1.22.8 manually to /usr/local/go + bash \ + curl \ + wget \ + tar \ + traceroute \ + openssl \ + iperf3 \ + busybox-extras \ + nmap \ + netcat-openbsd \ + tcpdump \ + mtr \ + socat \ + bind-tools \ + iproute2 \ + openssh-client \ + python3 \ + procps \ + coreutils \ + mongodb-tools \ + postgresql15-client \ + py3-flask + +# Set up build arguments (provided by buildx) +ARG TARGETOS +ARG TARGETARCH + +# Set Go version ENV GO_VERSION=1.22.8 -RUN wget https://dl.google.com/go/go$GO_VERSION.linux-amd64.tar.gz && \ - tar -C /usr/local -xzf go$GO_VERSION.linux-amd64.tar.gz && \ - rm go$GO_VERSION.linux-amd64.tar.gz +# Compose the correct URL for the architecture +ENV GO_URL=https://dl.google.com/go/go${GO_VERSION}.${TARGETOS}-${TARGETARCH}.tar.gz + +# Download and install Go based on target architecture +RUN wget -O go.tar.gz $GO_URL && \ + tar -C /usr/local -xzf go.tar.gz && \ + rm go.tar.gz # Set Go path ENV PATH="/usr/local/go/bin:${PATH}" @@ -40,8 +48,9 @@ RUN go version # Copy the Flask app COPY app.py /app.py -# Expose port 5000 for the app.py +# Expose port 5000 EXPOSE 5000 # Run the Flask app CMD ["python3", "/app.py"] +