forked from GoogleCloudPlatform/ops-agent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
1339 lines (1054 loc) · 46.7 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# This file was generated by dockerfiles/compile.go
# To re-generate, run from the repository root: go run ./dockerfiles
# Build as DOCKER_BUILDKIT=1 docker build -o /tmp/out .
# or DOCKER_BUILDKIT=1 docker build -o /tmp/out . --target=buster
# Generated tarball(s) will end up in /tmp/out
ARG CMAKE_VERSION=3.25.2
ARG OPENJDK_MAJOR_VERSION=17
ARG OPENJDK_FULL_VERSION=17.0.8
ARG OPENJDK_VERSION_SUFFIX=7
ARG GO_VERSION=1.21.5
# Manually prepare a recent enough version of CMake.
# This should be used on platforms where the default package manager
# does not provide a recent enough version (we require >= 3.12).
FROM alpine:latest AS cmake-amd64-recent
ARG CMAKE_VERSION
ENV hash=4d98de8d605da676e71a889dd94f80c76abb377fade2f21e3510e62ece1e1ada
ADD https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-linux-x86_64.sh \
/cmake.sh
FROM alpine:latest AS cmake-arm64-recent
ARG CMAKE_VERSION
ENV hash=73a35cab2174a3eb8f35083d55c80871185dc3808f3dae3558cd5fbdb29a4614
ADD https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-linux-aarch64.sh \
/cmake.sh
FROM cmake-${TARGETARCH}-recent AS cmake-install-recent
RUN set -xe; (echo "$hash /cmake.sh" | sha256sum -c)
# Manually prepare OpenJDK for the current architecture.
FROM alpine:latest AS openjdk-amd64
ARG OPENJDK_MAJOR_VERSION
ARG OPENJDK_FULL_VERSION
ARG OPENJDK_VERSION_SUFFIX
ENV hash=aa5fc7d388fe544e5d85902e68399d5299e931f9b280d358a3cbee218d6017b0
ADD https://github.com/adoptium/temurin${OPENJDK_MAJOR_VERSION}-binaries/releases/download/jdk-${OPENJDK_FULL_VERSION}%2B${OPENJDK_VERSION_SUFFIX}/OpenJDK${OPENJDK_MAJOR_VERSION}U-jdk_x64_linux_hotspot_${OPENJDK_FULL_VERSION}_${OPENJDK_VERSION_SUFFIX}.tar.gz \
/tmp/OpenJDK${OPENJDK_MAJOR_VERSION}U.tar.gz
FROM alpine:latest AS openjdk-arm64
ARG OPENJDK_MAJOR_VERSION
ARG OPENJDK_FULL_VERSION
ARG OPENJDK_VERSION_SUFFIX
ENV hash=c43688163cfdcb1a6e6fe202cc06a51891df746b954c55dbd01430e7d7326d00
ADD https://github.com/adoptium/temurin${OPENJDK_MAJOR_VERSION}-binaries/releases/download/jdk-${OPENJDK_FULL_VERSION}%2B${OPENJDK_VERSION_SUFFIX}/OpenJDK${OPENJDK_MAJOR_VERSION}U-jdk_aarch64_linux_hotspot_${OPENJDK_FULL_VERSION}_${OPENJDK_VERSION_SUFFIX}.tar.gz \
/tmp/OpenJDK${OPENJDK_MAJOR_VERSION}U.tar.gz
FROM openjdk-${TARGETARCH} as openjdk-install
ARG OPENJDK_MAJOR_VERSION
RUN set -xe; (echo "$hash /tmp/OpenJDK${OPENJDK_MAJOR_VERSION}U.tar.gz" | sha256sum -c)
RUN set -xe; \
mkdir -p /usr/local/java-${OPENJDK_MAJOR_VERSION}-openjdk && \
tar -xf /tmp/OpenJDK${OPENJDK_MAJOR_VERSION}U.tar.gz -C /usr/local/java-${OPENJDK_MAJOR_VERSION}-openjdk --strip-components=1
# ======================================
# Build Ops Agent for centos-7
# ======================================
FROM centos:7 AS centos7-build-base
ARG OPENJDK_MAJOR_VERSION
RUN set -x; yum -y update && \
yum -y install git systemd \
autoconf libtool libcurl-devel libtool-ltdl-devel openssl-devel yajl-devel \
gcc gcc-c++ make bison flex file systemd-devel zlib-devel gtest-devel rpm-build \
expect rpm-sign zip
COPY --from=openjdk-install /usr/local/java-${OPENJDK_MAJOR_VERSION}-openjdk/ /usr/local/java-${OPENJDK_MAJOR_VERSION}-openjdk
ENV JAVA_HOME /usr/local/java-${OPENJDK_MAJOR_VERSION}-openjdk/
COPY --from=cmake-install-recent /cmake.sh /cmake.sh
RUN set -x; bash /cmake.sh --skip-license --prefix=/usr/local
SHELL ["/bin/bash", "-c"]
# Install golang
ARG TARGETARCH
ARG GO_VERSION
ADD https://go.dev/dl/go${GO_VERSION}.linux-${TARGETARCH}.tar.gz /tmp/go${GO_VERSION}.tar.gz
RUN set -xe; \
tar -xf /tmp/go${GO_VERSION}.tar.gz -C /usr/local
ENV PATH="${PATH}:/usr/local/go/bin"
FROM centos7-build-base AS centos7-build-otel
WORKDIR /work
# Download golang deps
COPY ./submodules/opentelemetry-operations-collector/go.mod ./submodules/opentelemetry-operations-collector/go.sum submodules/opentelemetry-operations-collector/
RUN cd submodules/opentelemetry-operations-collector && go mod download
COPY ./submodules/opentelemetry-java-contrib submodules/opentelemetry-java-contrib
# Install gradle. The first invocation of gradlew does this
RUN cd submodules/opentelemetry-java-contrib && ./gradlew --no-daemon -Djdk.lang.Process.launchMechanism=vfork tasks
COPY ./submodules/opentelemetry-operations-collector submodules/opentelemetry-operations-collector
COPY ./builds/otel.sh .
RUN \
unset OTEL_TRACES_EXPORTER && \
unset OTEL_EXPORTER_OTLP_TRACES_ENDPOINT && \
unset OTEL_EXPORTER_OTLP_TRACES_PROTOCOL && \
./otel.sh /work/cache/
FROM centos7-build-base AS centos7-build-fluent-bit
WORKDIR /work
COPY ./submodules/fluent-bit submodules/fluent-bit
COPY ./builds/fluent_bit.sh .
RUN ./fluent_bit.sh /work/cache/
FROM centos7-build-base AS centos7-build-systemd
WORKDIR /work
COPY ./systemd systemd
COPY ./builds/systemd.sh .
RUN ./systemd.sh /work/cache/
FROM centos7-build-base AS centos7-build-golang-base
WORKDIR /work
COPY go.mod go.sum ./
# Fetch dependencies
RUN go mod download
COPY confgenerator confgenerator
COPY apps apps
COPY internal internal
FROM centos7-build-golang-base AS centos7-build-diagnostics
WORKDIR /work
COPY cmd/google_cloud_ops_agent_diagnostics cmd/google_cloud_ops_agent_diagnostics
COPY ./builds/ops_agent_diagnostics.sh .
RUN ./ops_agent_diagnostics.sh /work/cache/
FROM centos7-build-golang-base AS centos7-build-wrapper
WORKDIR /work
COPY cmd/agent_wrapper cmd/agent_wrapper
COPY ./builds/agent_wrapper.sh .
RUN ./agent_wrapper.sh /work/cache/
FROM centos7-build-golang-base AS centos7-build
WORKDIR /work
COPY . /work
# Run the build script once to build the ops agent engine to a cache
RUN mkdir -p /tmp/cache_run/golang && cp -r . /tmp/cache_run/golang
WORKDIR /tmp/cache_run/golang
RUN ./pkg/rpm/build.sh || true &> /dev/null
WORKDIR /work
COPY ./confgenerator/default-config.yaml /work/cache/etc/google-cloud-ops-agent/config.yaml
COPY --from=centos7-build-otel /work/cache /work/cache
COPY --from=centos7-build-fluent-bit /work/cache /work/cache
COPY --from=centos7-build-systemd /work/cache /work/cache
COPY --from=centos7-build-diagnostics /work/cache /work/cache
COPY --from=centos7-build-wrapper /work/cache /work/cache
RUN ./pkg/rpm/build.sh
FROM scratch AS centos7
COPY --from=centos7-build /tmp/google-cloud-ops-agent.tgz /google-cloud-ops-agent-centos-7.tgz
COPY --from=centos7-build /google-cloud-ops-agent*.rpm /
# ======================================
# Build Ops Agent for centos-8
# ======================================
FROM rockylinux:8 AS centos8-build-base
ARG OPENJDK_MAJOR_VERSION
RUN set -x; yum -y update && \
dnf -y install 'dnf-command(config-manager)' && \
yum config-manager --set-enabled powertools && \
yum -y install git systemd \
autoconf libtool libcurl-devel libtool-ltdl-devel openssl-devel yajl-devel \
gcc gcc-c++ make cmake bison flex file systemd-devel zlib-devel gtest-devel rpm-build systemd-rpm-macros java-${OPENJDK_MAJOR_VERSION}-openjdk-devel \
expect rpm-sign zip tzdata-java
SHELL ["/bin/bash", "-c"]
# Install golang
ARG TARGETARCH
ARG GO_VERSION
ADD https://go.dev/dl/go${GO_VERSION}.linux-${TARGETARCH}.tar.gz /tmp/go${GO_VERSION}.tar.gz
RUN set -xe; \
tar -xf /tmp/go${GO_VERSION}.tar.gz -C /usr/local
ENV PATH="${PATH}:/usr/local/go/bin"
FROM centos8-build-base AS centos8-build-otel
WORKDIR /work
# Download golang deps
COPY ./submodules/opentelemetry-operations-collector/go.mod ./submodules/opentelemetry-operations-collector/go.sum submodules/opentelemetry-operations-collector/
RUN cd submodules/opentelemetry-operations-collector && go mod download
COPY ./submodules/opentelemetry-java-contrib submodules/opentelemetry-java-contrib
# Install gradle. The first invocation of gradlew does this
RUN cd submodules/opentelemetry-java-contrib && ./gradlew --no-daemon -Djdk.lang.Process.launchMechanism=vfork tasks
COPY ./submodules/opentelemetry-operations-collector submodules/opentelemetry-operations-collector
COPY ./builds/otel.sh .
RUN \
unset OTEL_TRACES_EXPORTER && \
unset OTEL_EXPORTER_OTLP_TRACES_ENDPOINT && \
unset OTEL_EXPORTER_OTLP_TRACES_PROTOCOL && \
./otel.sh /work/cache/
FROM centos8-build-base AS centos8-build-fluent-bit
WORKDIR /work
COPY ./submodules/fluent-bit submodules/fluent-bit
COPY ./builds/fluent_bit.sh .
RUN ./fluent_bit.sh /work/cache/
FROM centos8-build-base AS centos8-build-systemd
WORKDIR /work
COPY ./systemd systemd
COPY ./builds/systemd.sh .
RUN ./systemd.sh /work/cache/
FROM centos8-build-base AS centos8-build-golang-base
WORKDIR /work
COPY go.mod go.sum ./
# Fetch dependencies
RUN go mod download
COPY confgenerator confgenerator
COPY apps apps
COPY internal internal
FROM centos8-build-golang-base AS centos8-build-diagnostics
WORKDIR /work
COPY cmd/google_cloud_ops_agent_diagnostics cmd/google_cloud_ops_agent_diagnostics
COPY ./builds/ops_agent_diagnostics.sh .
RUN ./ops_agent_diagnostics.sh /work/cache/
FROM centos8-build-golang-base AS centos8-build-wrapper
WORKDIR /work
COPY cmd/agent_wrapper cmd/agent_wrapper
COPY ./builds/agent_wrapper.sh .
RUN ./agent_wrapper.sh /work/cache/
FROM centos8-build-golang-base AS centos8-build
WORKDIR /work
COPY . /work
# Run the build script once to build the ops agent engine to a cache
RUN mkdir -p /tmp/cache_run/golang && cp -r . /tmp/cache_run/golang
WORKDIR /tmp/cache_run/golang
RUN ./pkg/rpm/build.sh || true &> /dev/null
WORKDIR /work
COPY ./confgenerator/default-config.yaml /work/cache/etc/google-cloud-ops-agent/config.yaml
COPY --from=centos8-build-otel /work/cache /work/cache
COPY --from=centos8-build-fluent-bit /work/cache /work/cache
COPY --from=centos8-build-systemd /work/cache /work/cache
COPY --from=centos8-build-diagnostics /work/cache /work/cache
COPY --from=centos8-build-wrapper /work/cache /work/cache
RUN ./pkg/rpm/build.sh
FROM scratch AS centos8
COPY --from=centos8-build /tmp/google-cloud-ops-agent.tgz /google-cloud-ops-agent-centos-8.tgz
COPY --from=centos8-build /google-cloud-ops-agent*.rpm /
# ======================================
# Build Ops Agent for rockylinux-9
# ======================================
FROM rockylinux:9 AS rockylinux9-build-base
ARG OPENJDK_MAJOR_VERSION
RUN set -x; dnf -y update && \
dnf -y install 'dnf-command(config-manager)' && \
dnf config-manager --set-enabled crb && \
dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm && \
dnf -y install git systemd \
autoconf libtool libcurl-devel libtool-ltdl-devel openssl-devel yajl-devel \
gcc gcc-c++ make cmake bison flex file systemd-devel zlib-devel gtest-devel rpm-build systemd-rpm-macros java-${OPENJDK_MAJOR_VERSION}-openjdk-devel \
expect rpm-sign zip tzdata-java
ENV JAVA_HOME /usr/lib/jvm/java-${OPENJDK_MAJOR_VERSION}-openjdk/
SHELL ["/bin/bash", "-c"]
# Install golang
ARG TARGETARCH
ARG GO_VERSION
ADD https://go.dev/dl/go${GO_VERSION}.linux-${TARGETARCH}.tar.gz /tmp/go${GO_VERSION}.tar.gz
RUN set -xe; \
tar -xf /tmp/go${GO_VERSION}.tar.gz -C /usr/local
ENV PATH="${PATH}:/usr/local/go/bin"
FROM rockylinux9-build-base AS rockylinux9-build-otel
WORKDIR /work
# Download golang deps
COPY ./submodules/opentelemetry-operations-collector/go.mod ./submodules/opentelemetry-operations-collector/go.sum submodules/opentelemetry-operations-collector/
RUN cd submodules/opentelemetry-operations-collector && go mod download
COPY ./submodules/opentelemetry-java-contrib submodules/opentelemetry-java-contrib
# Install gradle. The first invocation of gradlew does this
RUN cd submodules/opentelemetry-java-contrib && ./gradlew --no-daemon -Djdk.lang.Process.launchMechanism=vfork tasks
COPY ./submodules/opentelemetry-operations-collector submodules/opentelemetry-operations-collector
COPY ./builds/otel.sh .
RUN \
unset OTEL_TRACES_EXPORTER && \
unset OTEL_EXPORTER_OTLP_TRACES_ENDPOINT && \
unset OTEL_EXPORTER_OTLP_TRACES_PROTOCOL && \
./otel.sh /work/cache/
FROM rockylinux9-build-base AS rockylinux9-build-fluent-bit
WORKDIR /work
COPY ./submodules/fluent-bit submodules/fluent-bit
COPY ./builds/fluent_bit.sh .
RUN ./fluent_bit.sh /work/cache/
FROM rockylinux9-build-base AS rockylinux9-build-systemd
WORKDIR /work
COPY ./systemd systemd
COPY ./builds/systemd.sh .
RUN ./systemd.sh /work/cache/
FROM rockylinux9-build-base AS rockylinux9-build-golang-base
WORKDIR /work
COPY go.mod go.sum ./
# Fetch dependencies
RUN go mod download
COPY confgenerator confgenerator
COPY apps apps
COPY internal internal
FROM rockylinux9-build-golang-base AS rockylinux9-build-diagnostics
WORKDIR /work
COPY cmd/google_cloud_ops_agent_diagnostics cmd/google_cloud_ops_agent_diagnostics
COPY ./builds/ops_agent_diagnostics.sh .
RUN ./ops_agent_diagnostics.sh /work/cache/
FROM rockylinux9-build-golang-base AS rockylinux9-build-wrapper
WORKDIR /work
COPY cmd/agent_wrapper cmd/agent_wrapper
COPY ./builds/agent_wrapper.sh .
RUN ./agent_wrapper.sh /work/cache/
FROM rockylinux9-build-golang-base AS rockylinux9-build
WORKDIR /work
COPY . /work
# Run the build script once to build the ops agent engine to a cache
RUN mkdir -p /tmp/cache_run/golang && cp -r . /tmp/cache_run/golang
WORKDIR /tmp/cache_run/golang
RUN ./pkg/rpm/build.sh || true &> /dev/null
WORKDIR /work
COPY ./confgenerator/default-config.yaml /work/cache/etc/google-cloud-ops-agent/config.yaml
COPY --from=rockylinux9-build-otel /work/cache /work/cache
COPY --from=rockylinux9-build-fluent-bit /work/cache /work/cache
COPY --from=rockylinux9-build-systemd /work/cache /work/cache
COPY --from=rockylinux9-build-diagnostics /work/cache /work/cache
COPY --from=rockylinux9-build-wrapper /work/cache /work/cache
RUN ./pkg/rpm/build.sh
FROM scratch AS rockylinux9
COPY --from=rockylinux9-build /tmp/google-cloud-ops-agent.tgz /google-cloud-ops-agent-rockylinux-9.tgz
COPY --from=rockylinux9-build /google-cloud-ops-agent*.rpm /
# ======================================
# Build Ops Agent for debian-bookworm
# ======================================
FROM debian:bookworm AS bookworm-build-base
ARG OPENJDK_MAJOR_VERSION
RUN set -x; apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get -y install git systemd \
autoconf libtool libcurl4-openssl-dev libltdl-dev libssl-dev libyajl-dev \
build-essential cmake bison flex file libsystemd-dev \
devscripts cdbs pkg-config openjdk-${OPENJDK_MAJOR_VERSION}-jdk zip
SHELL ["/bin/bash", "-c"]
# Install golang
ARG TARGETARCH
ARG GO_VERSION
ADD https://go.dev/dl/go${GO_VERSION}.linux-${TARGETARCH}.tar.gz /tmp/go${GO_VERSION}.tar.gz
RUN set -xe; \
tar -xf /tmp/go${GO_VERSION}.tar.gz -C /usr/local
ENV PATH="${PATH}:/usr/local/go/bin"
FROM bookworm-build-base AS bookworm-build-otel
WORKDIR /work
# Download golang deps
COPY ./submodules/opentelemetry-operations-collector/go.mod ./submodules/opentelemetry-operations-collector/go.sum submodules/opentelemetry-operations-collector/
RUN cd submodules/opentelemetry-operations-collector && go mod download
COPY ./submodules/opentelemetry-java-contrib submodules/opentelemetry-java-contrib
# Install gradle. The first invocation of gradlew does this
RUN cd submodules/opentelemetry-java-contrib && ./gradlew --no-daemon -Djdk.lang.Process.launchMechanism=vfork tasks
COPY ./submodules/opentelemetry-operations-collector submodules/opentelemetry-operations-collector
COPY ./builds/otel.sh .
RUN \
unset OTEL_TRACES_EXPORTER && \
unset OTEL_EXPORTER_OTLP_TRACES_ENDPOINT && \
unset OTEL_EXPORTER_OTLP_TRACES_PROTOCOL && \
./otel.sh /work/cache/
FROM bookworm-build-base AS bookworm-build-fluent-bit
WORKDIR /work
COPY ./submodules/fluent-bit submodules/fluent-bit
COPY ./builds/fluent_bit.sh .
RUN ./fluent_bit.sh /work/cache/
FROM bookworm-build-base AS bookworm-build-systemd
WORKDIR /work
COPY ./systemd systemd
COPY ./builds/systemd.sh .
RUN ./systemd.sh /work/cache/
FROM bookworm-build-base AS bookworm-build-golang-base
WORKDIR /work
COPY go.mod go.sum ./
# Fetch dependencies
RUN go mod download
COPY confgenerator confgenerator
COPY apps apps
COPY internal internal
FROM bookworm-build-golang-base AS bookworm-build-diagnostics
WORKDIR /work
COPY cmd/google_cloud_ops_agent_diagnostics cmd/google_cloud_ops_agent_diagnostics
COPY ./builds/ops_agent_diagnostics.sh .
RUN ./ops_agent_diagnostics.sh /work/cache/
FROM bookworm-build-golang-base AS bookworm-build-wrapper
WORKDIR /work
COPY cmd/agent_wrapper cmd/agent_wrapper
COPY ./builds/agent_wrapper.sh .
RUN ./agent_wrapper.sh /work/cache/
FROM bookworm-build-golang-base AS bookworm-build
WORKDIR /work
COPY . /work
# Run the build script once to build the ops agent engine to a cache
RUN mkdir -p /tmp/cache_run/golang && cp -r . /tmp/cache_run/golang
WORKDIR /tmp/cache_run/golang
RUN ./pkg/deb/build.sh || true &> /dev/null
WORKDIR /work
COPY ./confgenerator/default-config.yaml /work/cache/etc/google-cloud-ops-agent/config.yaml
COPY --from=bookworm-build-otel /work/cache /work/cache
COPY --from=bookworm-build-fluent-bit /work/cache /work/cache
COPY --from=bookworm-build-systemd /work/cache /work/cache
COPY --from=bookworm-build-diagnostics /work/cache /work/cache
COPY --from=bookworm-build-wrapper /work/cache /work/cache
RUN ./pkg/deb/build.sh
FROM scratch AS bookworm
COPY --from=bookworm-build /tmp/google-cloud-ops-agent.tgz /google-cloud-ops-agent-debian-bookworm.tgz
COPY --from=bookworm-build /google-cloud-ops-agent*.deb /
# ======================================
# Build Ops Agent for debian-bullseye
# ======================================
FROM debian:bullseye AS bullseye-build-base
ARG OPENJDK_MAJOR_VERSION
RUN set -x; apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get -y install git systemd \
autoconf libtool libcurl4-openssl-dev libltdl-dev libssl-dev libyajl-dev \
build-essential cmake bison flex file libsystemd-dev \
devscripts cdbs pkg-config openjdk-${OPENJDK_MAJOR_VERSION}-jdk zip
SHELL ["/bin/bash", "-c"]
# Install golang
ARG TARGETARCH
ARG GO_VERSION
ADD https://go.dev/dl/go${GO_VERSION}.linux-${TARGETARCH}.tar.gz /tmp/go${GO_VERSION}.tar.gz
RUN set -xe; \
tar -xf /tmp/go${GO_VERSION}.tar.gz -C /usr/local
ENV PATH="${PATH}:/usr/local/go/bin"
FROM bullseye-build-base AS bullseye-build-otel
WORKDIR /work
# Download golang deps
COPY ./submodules/opentelemetry-operations-collector/go.mod ./submodules/opentelemetry-operations-collector/go.sum submodules/opentelemetry-operations-collector/
RUN cd submodules/opentelemetry-operations-collector && go mod download
COPY ./submodules/opentelemetry-java-contrib submodules/opentelemetry-java-contrib
# Install gradle. The first invocation of gradlew does this
RUN cd submodules/opentelemetry-java-contrib && ./gradlew --no-daemon -Djdk.lang.Process.launchMechanism=vfork tasks
COPY ./submodules/opentelemetry-operations-collector submodules/opentelemetry-operations-collector
COPY ./builds/otel.sh .
RUN \
unset OTEL_TRACES_EXPORTER && \
unset OTEL_EXPORTER_OTLP_TRACES_ENDPOINT && \
unset OTEL_EXPORTER_OTLP_TRACES_PROTOCOL && \
./otel.sh /work/cache/
FROM bullseye-build-base AS bullseye-build-fluent-bit
WORKDIR /work
COPY ./submodules/fluent-bit submodules/fluent-bit
COPY ./builds/fluent_bit.sh .
RUN ./fluent_bit.sh /work/cache/
FROM bullseye-build-base AS bullseye-build-systemd
WORKDIR /work
COPY ./systemd systemd
COPY ./builds/systemd.sh .
RUN ./systemd.sh /work/cache/
FROM bullseye-build-base AS bullseye-build-golang-base
WORKDIR /work
COPY go.mod go.sum ./
# Fetch dependencies
RUN go mod download
COPY confgenerator confgenerator
COPY apps apps
COPY internal internal
FROM bullseye-build-golang-base AS bullseye-build-diagnostics
WORKDIR /work
COPY cmd/google_cloud_ops_agent_diagnostics cmd/google_cloud_ops_agent_diagnostics
COPY ./builds/ops_agent_diagnostics.sh .
RUN ./ops_agent_diagnostics.sh /work/cache/
FROM bullseye-build-golang-base AS bullseye-build-wrapper
WORKDIR /work
COPY cmd/agent_wrapper cmd/agent_wrapper
COPY ./builds/agent_wrapper.sh .
RUN ./agent_wrapper.sh /work/cache/
FROM bullseye-build-golang-base AS bullseye-build
WORKDIR /work
COPY . /work
# Run the build script once to build the ops agent engine to a cache
RUN mkdir -p /tmp/cache_run/golang && cp -r . /tmp/cache_run/golang
WORKDIR /tmp/cache_run/golang
RUN ./pkg/deb/build.sh || true &> /dev/null
WORKDIR /work
COPY ./confgenerator/default-config.yaml /work/cache/etc/google-cloud-ops-agent/config.yaml
COPY --from=bullseye-build-otel /work/cache /work/cache
COPY --from=bullseye-build-fluent-bit /work/cache /work/cache
COPY --from=bullseye-build-systemd /work/cache /work/cache
COPY --from=bullseye-build-diagnostics /work/cache /work/cache
COPY --from=bullseye-build-wrapper /work/cache /work/cache
RUN ./pkg/deb/build.sh
FROM scratch AS bullseye
COPY --from=bullseye-build /tmp/google-cloud-ops-agent.tgz /google-cloud-ops-agent-debian-bullseye.tgz
COPY --from=bullseye-build /google-cloud-ops-agent*.deb /
# ======================================
# Build Ops Agent for debian-buster
# ======================================
FROM debian:buster AS buster-build-base
ARG OPENJDK_MAJOR_VERSION
RUN set -x; apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get -y install git systemd \
autoconf libtool libcurl4-openssl-dev libltdl-dev libssl-dev libyajl-dev \
build-essential cmake bison flex file libsystemd-dev \
devscripts cdbs pkg-config zip
COPY --from=openjdk-install /usr/local/java-${OPENJDK_MAJOR_VERSION}-openjdk/ /usr/local/java-${OPENJDK_MAJOR_VERSION}-openjdk
ENV JAVA_HOME /usr/local/java-${OPENJDK_MAJOR_VERSION}-openjdk/
SHELL ["/bin/bash", "-c"]
# Install golang
ARG TARGETARCH
ARG GO_VERSION
ADD https://go.dev/dl/go${GO_VERSION}.linux-${TARGETARCH}.tar.gz /tmp/go${GO_VERSION}.tar.gz
RUN set -xe; \
tar -xf /tmp/go${GO_VERSION}.tar.gz -C /usr/local
ENV PATH="${PATH}:/usr/local/go/bin"
FROM buster-build-base AS buster-build-otel
WORKDIR /work
# Download golang deps
COPY ./submodules/opentelemetry-operations-collector/go.mod ./submodules/opentelemetry-operations-collector/go.sum submodules/opentelemetry-operations-collector/
RUN cd submodules/opentelemetry-operations-collector && go mod download
COPY ./submodules/opentelemetry-java-contrib submodules/opentelemetry-java-contrib
# Install gradle. The first invocation of gradlew does this
RUN cd submodules/opentelemetry-java-contrib && ./gradlew --no-daemon -Djdk.lang.Process.launchMechanism=vfork tasks
COPY ./submodules/opentelemetry-operations-collector submodules/opentelemetry-operations-collector
COPY ./builds/otel.sh .
RUN \
unset OTEL_TRACES_EXPORTER && \
unset OTEL_EXPORTER_OTLP_TRACES_ENDPOINT && \
unset OTEL_EXPORTER_OTLP_TRACES_PROTOCOL && \
./otel.sh /work/cache/
FROM buster-build-base AS buster-build-fluent-bit
WORKDIR /work
COPY ./submodules/fluent-bit submodules/fluent-bit
COPY ./builds/fluent_bit.sh .
RUN ./fluent_bit.sh /work/cache/
FROM buster-build-base AS buster-build-systemd
WORKDIR /work
COPY ./systemd systemd
COPY ./builds/systemd.sh .
RUN ./systemd.sh /work/cache/
FROM buster-build-base AS buster-build-golang-base
WORKDIR /work
COPY go.mod go.sum ./
# Fetch dependencies
RUN go mod download
COPY confgenerator confgenerator
COPY apps apps
COPY internal internal
FROM buster-build-golang-base AS buster-build-diagnostics
WORKDIR /work
COPY cmd/google_cloud_ops_agent_diagnostics cmd/google_cloud_ops_agent_diagnostics
COPY ./builds/ops_agent_diagnostics.sh .
RUN ./ops_agent_diagnostics.sh /work/cache/
FROM buster-build-golang-base AS buster-build-wrapper
WORKDIR /work
COPY cmd/agent_wrapper cmd/agent_wrapper
COPY ./builds/agent_wrapper.sh .
RUN ./agent_wrapper.sh /work/cache/
FROM buster-build-golang-base AS buster-build
WORKDIR /work
COPY . /work
# Run the build script once to build the ops agent engine to a cache
RUN mkdir -p /tmp/cache_run/golang && cp -r . /tmp/cache_run/golang
WORKDIR /tmp/cache_run/golang
RUN ./pkg/deb/build.sh || true &> /dev/null
WORKDIR /work
COPY ./confgenerator/default-config.yaml /work/cache/etc/google-cloud-ops-agent/config.yaml
COPY --from=buster-build-otel /work/cache /work/cache
COPY --from=buster-build-fluent-bit /work/cache /work/cache
COPY --from=buster-build-systemd /work/cache /work/cache
COPY --from=buster-build-diagnostics /work/cache /work/cache
COPY --from=buster-build-wrapper /work/cache /work/cache
RUN ./pkg/deb/build.sh
FROM scratch AS buster
COPY --from=buster-build /tmp/google-cloud-ops-agent.tgz /google-cloud-ops-agent-debian-buster.tgz
COPY --from=buster-build /google-cloud-ops-agent*.deb /
# ======================================
# Build Ops Agent for sles-12
# ======================================
FROM opensuse/archive:42.3 AS sles12-build-base
ARG OPENJDK_MAJOR_VERSION
# Add home:odassau repo to install 3.4 bison
ADD https://download.opensuse.org/repositories/home:/odassau/SLE_12_SP4/home:odassau.repo /tmp/home:odassau.repo
RUN set -x; \
# The 'OSS Update' repo signature is no longer valid, so verify the checksum instead.
zypper --no-gpg-check refresh 'OSS Update' && \
(echo '6dd0b89202b19dae873434c5f2ba01164205071581fc02365712be801e304b3b /var/cache/zypp/raw/OSS Update/repodata/repomd.xml' | sha256sum --check) && \
zypper -n install git systemd autoconf automake flex libtool libcurl-devel libopenssl-devel libyajl-devel gcc gcc-c++ zlib-devel rpm-build expect cmake systemd-devel systemd-rpm-macros unzip zip && \
# Remove expired root certificate.
mv /var/lib/ca-certificates/pem/DST_Root_CA_X3.pem /etc/pki/trust/blacklist/ && \
update-ca-certificates && \
# Add home:odassau repo to install 3.4 bison
zypper addrepo /tmp/home:odassau.repo && \
zypper -n --gpg-auto-import-keys refresh && \
zypper -n update && \
# zypper/libcurl has a use-after-free bug that causes segfaults for particular download sequences.
# If this bug happens to trigger in the future, adding a "zypper -n download" of a subset of the packages can avoid the segfault.
zypper -n install 'bison>3' && \
# Allow fluent-bit to find systemd
ln -fs /usr/lib/systemd /lib/systemd
COPY --from=openjdk-install /usr/local/java-${OPENJDK_MAJOR_VERSION}-openjdk/ /usr/local/java-${OPENJDK_MAJOR_VERSION}-openjdk
ENV JAVA_HOME /usr/local/java-${OPENJDK_MAJOR_VERSION}-openjdk/
COPY --from=cmake-install-recent /cmake.sh /cmake.sh
RUN set -x; bash /cmake.sh --skip-license --prefix=/usr/local
SHELL ["/bin/bash", "-c"]
# Install golang
ARG TARGETARCH
ARG GO_VERSION
ADD https://go.dev/dl/go${GO_VERSION}.linux-${TARGETARCH}.tar.gz /tmp/go${GO_VERSION}.tar.gz
RUN set -xe; \
tar -xf /tmp/go${GO_VERSION}.tar.gz -C /usr/local
ENV PATH="${PATH}:/usr/local/go/bin"
FROM sles12-build-base AS sles12-build-otel
WORKDIR /work
# Download golang deps
COPY ./submodules/opentelemetry-operations-collector/go.mod ./submodules/opentelemetry-operations-collector/go.sum submodules/opentelemetry-operations-collector/
RUN cd submodules/opentelemetry-operations-collector && go mod download
COPY ./submodules/opentelemetry-java-contrib submodules/opentelemetry-java-contrib
# Install gradle. The first invocation of gradlew does this
RUN cd submodules/opentelemetry-java-contrib && ./gradlew --no-daemon -Djdk.lang.Process.launchMechanism=vfork tasks
COPY ./submodules/opentelemetry-operations-collector submodules/opentelemetry-operations-collector
COPY ./builds/otel.sh .
RUN \
unset OTEL_TRACES_EXPORTER && \
unset OTEL_EXPORTER_OTLP_TRACES_ENDPOINT && \
unset OTEL_EXPORTER_OTLP_TRACES_PROTOCOL && \
./otel.sh /work/cache/
FROM sles12-build-base AS sles12-build-fluent-bit
WORKDIR /work
COPY ./submodules/fluent-bit submodules/fluent-bit
COPY ./builds/fluent_bit.sh .
RUN ./fluent_bit.sh /work/cache/
FROM sles12-build-base AS sles12-build-systemd
WORKDIR /work
COPY ./systemd systemd
COPY ./builds/systemd.sh .
RUN ./systemd.sh /work/cache/
FROM sles12-build-base AS sles12-build-golang-base
WORKDIR /work
COPY go.mod go.sum ./
# Fetch dependencies
RUN go mod download
COPY confgenerator confgenerator
COPY apps apps
COPY internal internal
FROM sles12-build-golang-base AS sles12-build-diagnostics
WORKDIR /work
COPY cmd/google_cloud_ops_agent_diagnostics cmd/google_cloud_ops_agent_diagnostics
COPY ./builds/ops_agent_diagnostics.sh .
RUN ./ops_agent_diagnostics.sh /work/cache/
FROM sles12-build-golang-base AS sles12-build-wrapper
WORKDIR /work
COPY cmd/agent_wrapper cmd/agent_wrapper
COPY ./builds/agent_wrapper.sh .
RUN ./agent_wrapper.sh /work/cache/
FROM sles12-build-golang-base AS sles12-build
WORKDIR /work
COPY . /work
# Run the build script once to build the ops agent engine to a cache
RUN mkdir -p /tmp/cache_run/golang && cp -r . /tmp/cache_run/golang
WORKDIR /tmp/cache_run/golang
RUN ./pkg/rpm/build.sh || true &> /dev/null
WORKDIR /work
COPY ./confgenerator/default-config.yaml /work/cache/etc/google-cloud-ops-agent/config.yaml
COPY --from=sles12-build-otel /work/cache /work/cache
COPY --from=sles12-build-fluent-bit /work/cache /work/cache
COPY --from=sles12-build-systemd /work/cache /work/cache
COPY --from=sles12-build-diagnostics /work/cache /work/cache
COPY --from=sles12-build-wrapper /work/cache /work/cache
RUN ./pkg/rpm/build.sh
FROM scratch AS sles12
COPY --from=sles12-build /tmp/google-cloud-ops-agent.tgz /google-cloud-ops-agent-sles-12.tgz
COPY --from=sles12-build /google-cloud-ops-agent*.rpm /
# ======================================
# Build Ops Agent for sles-15
# ======================================
FROM opensuse/leap:15.1 AS sles15-build-base
ARG OPENJDK_MAJOR_VERSION
RUN set -x; zypper -n refresh && \
zypper -n update && \
zypper -n install git systemd autoconf automake flex libtool libcurl-devel libopenssl-devel libyajl-devel gcc gcc-c++ zlib-devel rpm-build expect cmake systemd-devel systemd-rpm-macros unzip zip 'bison>3'
# Allow fluent-bit to find systemd
RUN ln -fs /usr/lib/systemd /lib/systemd
COPY --from=openjdk-install /usr/local/java-${OPENJDK_MAJOR_VERSION}-openjdk/ /usr/local/java-${OPENJDK_MAJOR_VERSION}-openjdk
ENV JAVA_HOME /usr/local/java-${OPENJDK_MAJOR_VERSION}-openjdk/
COPY --from=cmake-install-recent /cmake.sh /cmake.sh
RUN set -x; bash /cmake.sh --skip-license --prefix=/usr/local
SHELL ["/bin/bash", "-c"]
# Install golang
ARG TARGETARCH
ARG GO_VERSION
ADD https://go.dev/dl/go${GO_VERSION}.linux-${TARGETARCH}.tar.gz /tmp/go${GO_VERSION}.tar.gz
RUN set -xe; \
tar -xf /tmp/go${GO_VERSION}.tar.gz -C /usr/local
ENV PATH="${PATH}:/usr/local/go/bin"
FROM sles15-build-base AS sles15-build-otel
WORKDIR /work
# Download golang deps
COPY ./submodules/opentelemetry-operations-collector/go.mod ./submodules/opentelemetry-operations-collector/go.sum submodules/opentelemetry-operations-collector/
RUN cd submodules/opentelemetry-operations-collector && go mod download
COPY ./submodules/opentelemetry-java-contrib submodules/opentelemetry-java-contrib
# Install gradle. The first invocation of gradlew does this
RUN cd submodules/opentelemetry-java-contrib && ./gradlew --no-daemon -Djdk.lang.Process.launchMechanism=vfork tasks
COPY ./submodules/opentelemetry-operations-collector submodules/opentelemetry-operations-collector
COPY ./builds/otel.sh .
RUN \
unset OTEL_TRACES_EXPORTER && \
unset OTEL_EXPORTER_OTLP_TRACES_ENDPOINT && \
unset OTEL_EXPORTER_OTLP_TRACES_PROTOCOL && \
./otel.sh /work/cache/
FROM sles15-build-base AS sles15-build-fluent-bit
WORKDIR /work
COPY ./submodules/fluent-bit submodules/fluent-bit
COPY ./builds/fluent_bit.sh .
RUN ./fluent_bit.sh /work/cache/
FROM sles15-build-base AS sles15-build-systemd
WORKDIR /work
COPY ./systemd systemd
COPY ./builds/systemd.sh .
RUN ./systemd.sh /work/cache/
FROM sles15-build-base AS sles15-build-golang-base
WORKDIR /work
COPY go.mod go.sum ./
# Fetch dependencies
RUN go mod download
COPY confgenerator confgenerator
COPY apps apps
COPY internal internal
FROM sles15-build-golang-base AS sles15-build-diagnostics
WORKDIR /work
COPY cmd/google_cloud_ops_agent_diagnostics cmd/google_cloud_ops_agent_diagnostics
COPY ./builds/ops_agent_diagnostics.sh .
RUN ./ops_agent_diagnostics.sh /work/cache/
FROM sles15-build-golang-base AS sles15-build-wrapper
WORKDIR /work
COPY cmd/agent_wrapper cmd/agent_wrapper
COPY ./builds/agent_wrapper.sh .
RUN ./agent_wrapper.sh /work/cache/
FROM sles15-build-golang-base AS sles15-build
WORKDIR /work
COPY . /work
# Run the build script once to build the ops agent engine to a cache
RUN mkdir -p /tmp/cache_run/golang && cp -r . /tmp/cache_run/golang
WORKDIR /tmp/cache_run/golang
RUN ./pkg/rpm/build.sh || true &> /dev/null
WORKDIR /work
COPY ./confgenerator/default-config.yaml /work/cache/etc/google-cloud-ops-agent/config.yaml
COPY --from=sles15-build-otel /work/cache /work/cache
COPY --from=sles15-build-fluent-bit /work/cache /work/cache
COPY --from=sles15-build-systemd /work/cache /work/cache
COPY --from=sles15-build-diagnostics /work/cache /work/cache
COPY --from=sles15-build-wrapper /work/cache /work/cache
RUN ./pkg/rpm/build.sh
FROM scratch AS sles15
COPY --from=sles15-build /tmp/google-cloud-ops-agent.tgz /google-cloud-ops-agent-sles-15.tgz
COPY --from=sles15-build /google-cloud-ops-agent*.rpm /
# ======================================
# Build Ops Agent for ubuntu-focal
# ======================================
FROM ubuntu:focal AS focal-build-base
ARG OPENJDK_MAJOR_VERSION
RUN set -x; apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get -y install git systemd \
autoconf libtool libcurl4-openssl-dev libltdl-dev libssl-dev libyajl-dev \
build-essential cmake bison flex file libsystemd-dev \
devscripts cdbs pkg-config openjdk-${OPENJDK_MAJOR_VERSION}-jdk zip
SHELL ["/bin/bash", "-c"]
# Install golang
ARG TARGETARCH
ARG GO_VERSION
ADD https://go.dev/dl/go${GO_VERSION}.linux-${TARGETARCH}.tar.gz /tmp/go${GO_VERSION}.tar.gz
RUN set -xe; \
tar -xf /tmp/go${GO_VERSION}.tar.gz -C /usr/local
ENV PATH="${PATH}:/usr/local/go/bin"
FROM focal-build-base AS focal-build-otel
WORKDIR /work
# Download golang deps
COPY ./submodules/opentelemetry-operations-collector/go.mod ./submodules/opentelemetry-operations-collector/go.sum submodules/opentelemetry-operations-collector/
RUN cd submodules/opentelemetry-operations-collector && go mod download
COPY ./submodules/opentelemetry-java-contrib submodules/opentelemetry-java-contrib
# Install gradle. The first invocation of gradlew does this
RUN cd submodules/opentelemetry-java-contrib && ./gradlew --no-daemon -Djdk.lang.Process.launchMechanism=vfork tasks
COPY ./submodules/opentelemetry-operations-collector submodules/opentelemetry-operations-collector
COPY ./builds/otel.sh .
RUN \
unset OTEL_TRACES_EXPORTER && \
unset OTEL_EXPORTER_OTLP_TRACES_ENDPOINT && \
unset OTEL_EXPORTER_OTLP_TRACES_PROTOCOL && \
./otel.sh /work/cache/
FROM focal-build-base AS focal-build-fluent-bit
WORKDIR /work
COPY ./submodules/fluent-bit submodules/fluent-bit
COPY ./builds/fluent_bit.sh .
RUN ./fluent_bit.sh /work/cache/
FROM focal-build-base AS focal-build-systemd
WORKDIR /work
COPY ./systemd systemd
COPY ./builds/systemd.sh .
RUN ./systemd.sh /work/cache/
FROM focal-build-base AS focal-build-golang-base
WORKDIR /work
COPY go.mod go.sum ./
# Fetch dependencies
RUN go mod download
COPY confgenerator confgenerator
COPY apps apps
COPY internal internal
FROM focal-build-golang-base AS focal-build-diagnostics
WORKDIR /work
COPY cmd/google_cloud_ops_agent_diagnostics cmd/google_cloud_ops_agent_diagnostics
COPY ./builds/ops_agent_diagnostics.sh .
RUN ./ops_agent_diagnostics.sh /work/cache/
FROM focal-build-golang-base AS focal-build-wrapper
WORKDIR /work
COPY cmd/agent_wrapper cmd/agent_wrapper
COPY ./builds/agent_wrapper.sh .
RUN ./agent_wrapper.sh /work/cache/