Skip to content

Commit c3cef79

Browse files
authored
Separate dev-image from main Dockerfile (signalfx#1421)
1 parent 7ef80a7 commit c3cef79

File tree

4 files changed

+104
-93
lines changed

4 files changed

+104
-93
lines changed

Dockerfile

Lines changed: 2 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ RUN find /usr/local/lib/python3.8 -name "*.pyc" -o -name "*.pyo" | xargs rm
241241
# We don't support compiling extension modules so don't need this directory
242242
RUN rm -rf /usr/local/lib/python3.8/config-*-linux-gnu
243243

244+
244245
######### Java monitor dependencies and monitor jar compilation
245246
FROM ubuntu:16.04 as java
246247

@@ -378,97 +379,6 @@ COPY --from=agent-builder /usr/bin/signalfx-agent /bin/signalfx-agent
378379
WORKDIR /
379380

380381

381-
####### Dev Image ########
382-
# This is an image to facilitate development of the agent. It installs all of
383-
# the build tools for building collectd and the go agent, along with some other
384-
# useful utilities. The agent image is copied from the final-image stage to
385-
# the /bundle dir in here and the SIGNALFX_BUNDLE_DIR is set to point to that.
386-
FROM ubuntu:18.04 as dev-extras
387-
388-
RUN apt update &&\
389-
apt install -y \
390-
build-essential \
391-
curl \
392-
git \
393-
inotify-tools \
394-
iproute2 \
395-
jq \
396-
net-tools \
397-
python3.8 \
398-
python3.8-dev \
399-
python3.8-distutils \
400-
socat \
401-
sudo \
402-
vim \
403-
wget
404-
405-
ENV PATH=$PATH:/usr/local/go/bin:/go/bin GOPATH=/go
406-
ENV SIGNALFX_BUNDLE_DIR=/bundle \
407-
TEST_SERVICES_DIR=/usr/src/signalfx-agent/test-services \
408-
AGENT_BIN=/usr/src/signalfx-agent/signalfx-agent \
409-
PYTHONPATH=/usr/src/signalfx-agent/python \
410-
AGENT_VERSION=latest \
411-
BUILD_TIME=2017-01-25T13:17:17-0500 \
412-
GOOS=linux \
413-
LC_ALL=C.UTF-8 \
414-
LANG=C.UTF-8
415-
416-
RUN rm -f /usr/bin/python3 && \
417-
ln -s /usr/bin/python3.8 /usr/bin/python && \
418-
ln -s /usr/bin/python3.8 /usr/bin/python3
419-
420-
RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && \
421-
python get-pip.py pip==20.0.2 && \
422-
rm get-pip.py
423-
424-
RUN curl -fsSL get.docker.com -o /tmp/get-docker.sh &&\
425-
sh /tmp/get-docker.sh
426-
427-
ARG TARGET_ARCH
428-
429-
RUN wget -O /usr/bin/gomplate https://github.com/hairyhenderson/gomplate/releases/download/v3.4.0/gomplate_linux-${TARGET_ARCH} &&\
430-
chmod +x /usr/bin/gomplate
431-
432-
# Install helm
433-
ARG HELM_VERSION=v3.0.0
434-
WORKDIR /tmp
435-
RUN wget -O helm.tar.gz https://get.helm.sh/helm-${HELM_VERSION}-linux-${TARGET_ARCH}.tar.gz && \
436-
tar -zxvf /tmp/helm.tar.gz && \
437-
mv linux-${TARGET_ARCH}/helm /usr/local/bin/helm && \
438-
chmod a+x /usr/local/bin/helm
439-
440-
# Install kubectl
441-
ARG KUBECTL_VERSION=v1.14.1
442-
RUN cd /tmp &&\
443-
curl -LO https://storage.googleapis.com/kubernetes-release/release/${KUBECTL_VERSION}/bin/linux/${TARGET_ARCH}/kubectl &&\
444-
chmod +x ./kubectl &&\
445-
mv ./kubectl /usr/bin/kubectl
446-
447-
# Get integration test deps in here
448-
RUN pip3 install ipython ipdb
449-
COPY tests/requirements.txt /tmp/
450-
RUN pip3 install -r /tmp/requirements.txt
451-
RUN ln -s /usr/bin/pip3 /usr/bin/pip
452-
453-
WORKDIR /usr/src/signalfx-agent
454-
455-
COPY --from=final-image /bin/signalfx-agent ./signalfx-agent
456-
COPY --from=final-image / /bundle/
457-
RUN /bundle/bin/patch-interpreter /bundle
458-
459-
COPY --from=agent-builder /usr/local/go /usr/local/go
460-
COPY --from=agent-builder /go $GOPATH
461-
462-
RUN go get -u golang.org/x/lint/golint &&\
463-
if [ `uname -m` != "aarch64" ]; then go get github.com/derekparker/delve/cmd/dlv; fi &&\
464-
go get github.com/tebeka/go2xunit &&\
465-
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(go env GOPATH)/bin v1.23.8
466-
467-
COPY ./ ./
468-
469-
CMD ["/bin/bash"]
470-
471-
472382
####### Pandoc Converter ########
473383
FROM ubuntu:16.04 as pandoc-converter
474384

@@ -513,6 +423,7 @@ RUN rm -f /usr/lib/signalfx-agent/bin/agent-status
513423
RUN /usr/lib/signalfx-agent/bin/patch-interpreter /usr/lib/signalfx-agent
514424
RUN mv /usr/lib/signalfx-agent ./signalfx-agent
515425

426+
516427
###### RPM Packager #######
517428
FROM fedora:27 as rpm-packager
518429

Dockerfile.dev

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
####### Dev Image ########
2+
# Note: Run `make dev-image` from the root directory of the repo.
3+
#
4+
# This is an image to facilitate development of the agent. It installs all of
5+
# the build tools for building collectd and the go agent, along with some other
6+
# useful utilities. The agent image is copied from the final-image stage to
7+
# the /bundle dir in here and the SIGNALFX_BUNDLE_DIR is set to point to that.
8+
FROM ubuntu:18.04
9+
10+
RUN apt update &&\
11+
apt install -y \
12+
build-essential \
13+
curl \
14+
git \
15+
inotify-tools \
16+
iproute2 \
17+
jq \
18+
net-tools \
19+
python3.8 \
20+
python3.8-dev \
21+
python3.8-distutils \
22+
socat \
23+
sudo \
24+
vim \
25+
wget
26+
27+
ENV PATH=$PATH:/usr/local/go/bin:/go/bin GOPATH=/go
28+
ENV SIGNALFX_BUNDLE_DIR=/bundle \
29+
TEST_SERVICES_DIR=/usr/src/signalfx-agent/test-services \
30+
AGENT_BIN=/usr/src/signalfx-agent/signalfx-agent \
31+
PYTHONPATH=/usr/src/signalfx-agent/python \
32+
AGENT_VERSION=latest \
33+
BUILD_TIME=2017-01-25T13:17:17-0500 \
34+
GOOS=linux \
35+
LC_ALL=C.UTF-8 \
36+
LANG=C.UTF-8
37+
38+
RUN rm -f /usr/bin/python3 && \
39+
ln -s /usr/bin/python3.8 /usr/bin/python && \
40+
ln -s /usr/bin/python3.8 /usr/bin/python3
41+
42+
RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && \
43+
python get-pip.py pip==20.0.2 && \
44+
rm get-pip.py
45+
46+
RUN curl -fsSL get.docker.com -o /tmp/get-docker.sh &&\
47+
sh /tmp/get-docker.sh
48+
49+
ARG TARGET_ARCH=amd64
50+
51+
RUN wget -O /usr/bin/gomplate https://github.com/hairyhenderson/gomplate/releases/download/v3.4.0/gomplate_linux-${TARGET_ARCH} &&\
52+
chmod +x /usr/bin/gomplate
53+
54+
# Install helm
55+
ARG HELM_VERSION=v3.0.0
56+
WORKDIR /tmp
57+
RUN wget -O helm.tar.gz https://get.helm.sh/helm-${HELM_VERSION}-linux-${TARGET_ARCH}.tar.gz && \
58+
tar -zxvf /tmp/helm.tar.gz && \
59+
mv linux-${TARGET_ARCH}/helm /usr/local/bin/helm && \
60+
chmod a+x /usr/local/bin/helm
61+
62+
# Install kubectl
63+
ARG KUBECTL_VERSION=v1.14.1
64+
RUN cd /tmp &&\
65+
curl -LO https://storage.googleapis.com/kubernetes-release/release/${KUBECTL_VERSION}/bin/linux/${TARGET_ARCH}/kubectl &&\
66+
chmod +x ./kubectl &&\
67+
mv ./kubectl /usr/bin/kubectl
68+
69+
# Get integration test deps in here
70+
RUN pip3 install ipython ipdb
71+
COPY tests/requirements.txt /tmp/
72+
RUN pip3 install -r /tmp/requirements.txt
73+
RUN ln -s /usr/bin/pip3 /usr/bin/pip
74+
75+
WORKDIR /usr/src/signalfx-agent
76+
77+
COPY --from=signalfx-agent-dev-cache:stage-final-image /bin/signalfx-agent ./signalfx-agent
78+
COPY --from=signalfx-agent-dev-cache:stage-final-image / /bundle/
79+
RUN /bundle/bin/patch-interpreter /bundle
80+
81+
COPY --from=signalfx-agent-dev-cache:stage-agent-builder /usr/local/go /usr/local/go
82+
COPY --from=signalfx-agent-dev-cache:stage-agent-builder /go $GOPATH
83+
84+
RUN go get -u golang.org/x/lint/golint &&\
85+
if [ `uname -m` != "aarch64" ]; then go get github.com/derekparker/delve/cmd/dlv; fi &&\
86+
go get github.com/tebeka/go2xunit &&\
87+
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(go env GOPATH)/bin v1.23.8
88+
89+
COPY ./ ./
90+
91+
CMD ["/bin/bash"]

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ rpm-%-package:
8686

8787
.PHONY: dev-image
8888
dev-image:
89-
bash -ec "COLLECTD_VERSION=$(COLLECTD_VERSION) COLLECTD_COMMIT=$(COLLECTD_COMMIT) && source scripts/common.sh && do_docker_build signalfx-agent-dev latest dev-extras"
89+
COLLECTD_VERSION=$(COLLECTD_VERSION) COLLECTD_COMMIT=$(COLLECTD_COMMIT) scripts/make-dev-image
9090

9191
.PHONY: debug
9292
debug:

scripts/make-dev-image

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,13 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
66

77
. $SCRIPT_DIR/common.sh
88

9-
COLLECTD_VERSION=${COLLECTD_VERSION} COLLECTD_COMMIT=${COLLECTD_COMMIT} do_docker_build signalfx-agent-dev latest dev-extras
9+
COLLECTD_VERSION=${COLLECTD_VERSION} COLLECTD_COMMIT=${COLLECTD_COMMIT} do_docker_build signalfx-agent-dev-cache stage-agent-builder agent-builder latest
10+
11+
COLLECTD_VERSION=${COLLECTD_VERSION} COLLECTD_COMMIT=${COLLECTD_COMMIT} do_docker_build signalfx-agent-dev-cache stage-final-image final-image latest
12+
13+
target_arch="amd64"
14+
if [ "$(uname -m)" == "aarch64" ]; then
15+
target_arch="arm64"
16+
fi
17+
18+
docker build -t signalfx-agent-dev:latest --build-arg TARGET_ARCH=${target_arch} -f ${SCRIPT_DIR}/../Dockerfile.dev ${SCRIPT_DIR}/../

0 commit comments

Comments
 (0)