Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build is broken #31

Open
aeimer opened this issue Oct 12, 2022 · 1 comment
Open

Build is broken #31

aeimer opened this issue Oct 12, 2022 · 1 comment

Comments

@aeimer
Copy link

aeimer commented Oct 12, 2022

The build breaks around the go get or rm after that go get in step 8 with exit code 2, nothing more.

@aeimer
Copy link
Author

aeimer commented Dec 7, 2022

Ok so I fixed the build for x64, I applied the following diff with git apply fix.path:

diff --git a/Dockerfile b/Dockerfile
index 56bc850..66bba9f 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,20 +1,14 @@
-FROM python:slim
+FROM debian:bullseye-slim as main
 
+ARG CONFD_VERSION
 ARG UPSTREAM_VERSION
 ARG MAXMIND_LICENSE_KEY
 
-ENV GOPATH /go
-ENV PATH /go/bin:$PATH
-
-RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin
-
 RUN apt-get update \
-  && apt-get install -y git software-properties-common wget \
-  && add-apt-repository ppa:longsleep/golang-backports \
-  && apt-get install -y golang-go
+  && apt-get install -y git software-properties-common wget python3 python3-pip
 
-RUN go get -v -u github.com/kelseyhightower/confd \
-  && rm -rf /go/src/github.com/kelseyhightower/confd \
+RUN wget -O /usr/local/bin/confd https://github.com/kelseyhightower/confd/releases/download/v${CONFD_VERSION}/confd-${CONFD_VERSION}-linux-amd64 \
+  && chmod +x /usr/local/bin/confd \
   && pip install gunicorn \
   && mkdir /openvpn-monitor \
   && wget -O - https://github.com/furlongm/openvpn-monitor/archive/${UPSTREAM_VERSION}.tar.gz | tar -C /openvpn-monitor --strip-components=1 -zxvf - \
@@ -22,9 +16,7 @@ RUN go get -v -u github.com/kelseyhightower/confd \
   && pip install /openvpn-monitor \
   && mkdir -p /var/lib/GeoIP/ \
   && wget -O - "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-City&license_key=$MAXMIND_LICENSE_KEY&suffix=tar.gz" | tar -C /var/lib/GeoIP/ --strip-components=1 -zxvf - \
-  && rm -rf /var/lib/apt/lists/ \
-  && rm -rf /usr/lib/go-1.11 \
-  && rm -rf $GOPATH/src
+  && rm -rf /var/lib/apt/lists/
 
 COPY confd /etc/confd
 COPY entrypoint.sh /

The original:

FROM debian:bullseye-slim as main

ARG CONFD_VERSION
ARG UPSTREAM_VERSION
ARG MAXMIND_LICENSE_KEY

RUN apt-get update \
  && apt-get install -y git software-properties-common wget python3 python3-pip

RUN wget -O /usr/local/bin/confd https://github.com/kelseyhightower/confd/releases/download/v${CONFD_VERSION}/confd-${CONFD_VERSION}-linux-amd64 \
  && chmod +x /usr/local/bin/confd \
  && pip install gunicorn \
  && mkdir /openvpn-monitor \
  && wget -O - https://github.com/furlongm/openvpn-monitor/archive/${UPSTREAM_VERSION}.tar.gz | tar -C /openvpn-monitor --strip-components=1 -zxvf - \
  && cp /openvpn-monitor/openvpn-monitor.conf.example /openvpn-monitor/openvpn-monitor.conf \
  && pip install /openvpn-monitor \
  && mkdir -p /var/lib/GeoIP/ \
  && wget -O - "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-City&license_key=$MAXMIND_LICENSE_KEY&suffix=tar.gz" | tar -C /var/lib/GeoIP/ --strip-components=1 -zxvf - \
  && rm -rf /var/lib/apt/lists/

COPY confd /etc/confd
COPY entrypoint.sh /

WORKDIR /openvpn-monitor

EXPOSE 80

ENTRYPOINT ["/entrypoint.sh"]

CMD ["gunicorn", "openvpn-monitor", "--bind", "0.0.0.0:80"]

I'd strongly suggest to use more fixed versions and also use proper base images like ubuntu, debian or alpine. Just install the normal packages and you should be good to go.

For a custom build with go (for multi platform builds) I would suggest to do it so:

FROM golang:1.19-bullseye as golang-build

ARG CONFD_VERSION

RUN mkdir -p $GOPATH/src/github.com/kelseyhightower \
  && git clone --depth 1 --branch "v${CONFD_VERSION}" https://github.com/kelseyhightower/confd.git $GOPATH/src/github.com/kelseyhightower/confd \
  && cd $GOPATH/src/github.com/kelseyhightower/confd \
  && make

#################

FROM debian:bullseye-slim as main

ARG UPSTREAM_VERSION
ARG MAXMIND_LICENSE_KEY

RUN apt-get update \
  && apt-get install -y git software-properties-common wget python3 python3-pip

RUN pip install gunicorn \
  && mkdir /openvpn-monitor \
  && wget -O - https://github.com/furlongm/openvpn-monitor/archive/${UPSTREAM_VERSION}.tar.gz | tar -C /openvpn-monitor --strip-components=1 -zxvf - \
  && cp /openvpn-monitor/openvpn-monitor.conf.example /openvpn-monitor/openvpn-monitor.conf \
  && pip install /openvpn-monitor \
  && mkdir -p /var/lib/GeoIP/ \
  && wget -O - "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-City&license_key=$MAXMIND_LICENSE_KEY&suffix=tar.gz" | tar -C /var/lib/GeoIP/ --strip-components=1 -zxvf - \
  && rm -rf /var/lib/apt/lists/

COPY confd /etc/confd
COPY entrypoint.sh /
COPY --from golang-build /go/...../confd /usr/local/bin/confd

WORKDIR /openvpn-monitor

EXPOSE 80

ENTRYPOINT ["/entrypoint.sh"]

CMD ["gunicorn", "openvpn-monitor", "--bind", "0.0.0.0:80"]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant