1
- FROM ubuntu:20.04 as build-image
2
- ARG TARGETARCH=amd64
1
+ FROM --platform=$BUILDPLATFORM ubuntu:20.04 as build-image
2
+
3
+ ARG TARGETARCH
3
4
ENV TARGETARCH "${TARGETARCH}"
5
+ # The semver version associated with this build (i.e. v3.0.0)
6
+ ARG NF_IMAGE_VERSION
7
+ ENV NF_IMAGE_VERSION "${NF_IMAGE_VERSION:-latest}"
8
+ # The commit SHA tag associated with this build
9
+ ARG NF_IMAGE_TAG
10
+ ENV NF_IMAGE_TAG "${NF_IMAGE_TAG:-latest}"
11
+ # The codename associated with this build (i.e. focal)
12
+ ARG NF_IMAGE_NAME
13
+ ENV NF_IMAGE_NAME "${NF_IMAGE_NAME:-focal}"
14
+
15
+ ENV LANGUAGE en_US:en
16
+ ENV LANG en_US.UTF-8
17
+ ENV LC_ALL en_US.UTF-8
18
+ ENV PANDOC_VERSION 2.13
4
19
5
20
LABEL maintainer Netlify
6
21
@@ -10,11 +25,6 @@ LABEL maintainer Netlify
10
25
#
11
26
# ###############################################################################
12
27
13
- ENV LANGUAGE en_US:en
14
- ENV LANG en_US.UTF-8
15
- ENV LC_ALL en_US.UTF-8
16
- ENV PANDOC_VERSION 2.13
17
-
18
28
# language export needed for ondrej/php PPA https://github.com/oerdnj/deb.sury.org/issues/56
19
29
RUN export DEBIAN_FRONTEND=noninteractive && \
20
30
apt-get -y update && \
@@ -194,17 +204,27 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
194
204
#
195
205
# ###############################################################################
196
206
197
- RUN wget -nv https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.focal_$TARGETARCH.deb && \
207
+ RUN wget -nv --quiet https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.focal_$TARGETARCH.deb && \
198
208
dpkg -i wkhtmltox_0.12.6-1.focal_$TARGETARCH.deb && \
199
209
rm wkhtmltox_0.12.6-1.focal_$TARGETARCH.deb && \
200
- wkhtmltopdf -V
201
-
202
- # install Pandoc (more recent version to what is provided in Ubuntu 14.04)
203
- RUN wget https://github.com/jgm/pandoc/releases/download/$PANDOC_VERSION/pandoc-$PANDOC_VERSION-1-$TARGETARCH.deb && \
210
+ wkhtmltopdf -V && \
211
+ # install Pandoc (more recent version to what is provided in Ubuntu 14.04)
212
+ wget --quiet https://github.com/jgm/pandoc/releases/download/$PANDOC_VERSION/pandoc-$PANDOC_VERSION-1-$TARGETARCH.deb && \
204
213
dpkg -i pandoc-$PANDOC_VERSION-1-$TARGETARCH.deb && \
205
214
rm pandoc-$PANDOC_VERSION-1-$TARGETARCH.deb && \
206
215
pandoc -v
207
216
217
+
218
+ # ###############################################################################
219
+ #
220
+ # Elm compiler
221
+ #
222
+ # ###############################################################################
223
+ RUN curl -L -o elm.gz https://github.com/elm/compiler/releases/download/0.19.1/binary-for-linux-64-bit.gz \
224
+ && gunzip elm.gz \
225
+ && chmod +x elm \
226
+ && mv elm /usr/local/bin/
227
+
208
228
# ###############################################################################
209
229
#
210
230
# User
@@ -263,7 +283,7 @@ ENV NETLIFY_NODE_VERSION="16"
263
283
264
284
RUN /bin/bash -c ". ~/.nvm/nvm.sh && \
265
285
nvm install --no-progress $NETLIFY_NODE_VERSION && \
266
- npm install -g grunt-cli bower elm@$ELM_VERSION && \
286
+ npm install -g grunt-cli bower && \
267
287
bash /usr/local/bin/yarn-installer.sh --version $YARN_VERSION && \
268
288
nvm alias default node && nvm cache clear"
269
289
ENV PATH "/opt/buildhome/.yarn/bin:$PATH"
@@ -284,13 +304,12 @@ USER buildbot
284
304
285
305
RUN virtualenv -p python2.7 /opt/buildhome/python2.7 && \
286
306
/bin/bash -c 'source /opt/buildhome/python2.7/bin/activate' && \
287
- ln -nfs /opt/buildhome/python2.7 /opt/buildhome/python2.7.18
288
-
289
- RUN virtualenv -p python3.8 /opt/buildhome/python3.8 && \
307
+ ln -nfs /opt/buildhome/python2.7 /opt/buildhome/python2.7.18 && \
308
+ virtualenv -p python3.8 /opt/buildhome/python3.8 && \
290
309
/bin/bash -c 'source /opt/buildhome/python3.8/bin/activate' && \
291
- ln -nfs /opt/buildhome/python3.8 /opt/buildhome/python3.8.10
292
-
293
- RUN /opt/buildhome/python${PIPENV_RUNTIME}/bin/pip install pipenv
310
+ # Python 3.8
311
+ ln -nfs /opt/buildhome/python3.8 /opt/buildhome/python3.8.10 && \
312
+ /opt/buildhome/python${PIPENV_RUNTIME}/bin/pip install pipenv
294
313
295
314
USER root
296
315
@@ -334,28 +353,26 @@ RUN binrc install gohugoio/hugo ${HUGO_VERSION} -c /opt/buildhome/.binrc | xargs
334
353
RUN mkdir /opt/leiningen && cd /opt/leiningen && \
335
354
curl -sL https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein > lein && \
336
355
chmod +x lein && \
337
- ln -s /opt/leiningen/lein /usr/local/bin/lein
338
-
339
- RUN mkdir /opt/boot-clj && cd /opt/boot-clj && \
356
+ ln -s /opt/leiningen/lein /usr/local/bin/lein && \
357
+ mkdir /opt/boot-clj && cd /opt/boot-clj && \
340
358
curl -sL https://github.com/boot-clj/boot-bin/releases/download/2.5.2/boot.sh > boot && \
341
359
chmod +x boot && \
342
- ln -s /opt/boot-clj/boot /usr/local/bin/boot
343
-
344
- RUN curl -sL https://download.clojure.org/install/linux-install-1.10.1.492.sh | bash
360
+ ln -s /opt/boot-clj/boot /usr/local/bin/boot && \
361
+ curl -sL https://download.clojure.org/install/linux-install-1.10.1.492.sh | bash
345
362
346
363
USER buildbot
347
364
348
- RUN lein
349
-
350
- RUN boot -u
365
+ RUN lein && \
366
+ boot -u
351
367
352
368
# ###############################################################################
353
369
#
354
370
# Cask
355
371
#
356
372
# ###############################################################################
357
373
USER buildbot
358
- RUN rm -rf /opt/buildhome/.cask && git clone https://github.com/cask/cask.git /opt/buildhome/.cask
374
+ RUN rm -rf /opt/buildhome/.cask && \
375
+ git clone https://github.com/cask/cask.git /opt/buildhome/.cask
359
376
ENV PATH "$PATH:/opt/buildhome/.cask/bin"
360
377
361
378
# ##
@@ -381,14 +398,15 @@ USER root
381
398
# set default to 8.0
382
399
RUN update-alternatives --set php /usr/bin/php8.0 && \
383
400
update-alternatives --set phar /usr/bin/phar8.0 && \
384
- update-alternatives --set phar.phar /usr/bin/phar.phar8.0
385
-
386
- RUN wget https://raw.githubusercontent.com/composer/getcomposer.org/76a7060ccb93902cd7576b67264ad91c8a2700e2/web/installer -O - -q | php -- --quiet && \
401
+ update-alternatives --set phar.phar /usr/bin/phar.phar8.0 && \
402
+ wget https://raw.githubusercontent.com/composer/getcomposer.org/76a7060ccb93902cd7576b67264ad91c8a2700e2/web/installer -O - -q | php -- --quiet && \
387
403
mv composer.phar /usr/local/bin/composer
388
404
389
405
USER buildbot
390
406
391
- RUN mkdir -p /opt/buildhome/.php && ln -s /usr/bin/php8.0 /opt/buildhome/.php/php
407
+ RUN mkdir -p /opt/buildhome/.php && \
408
+ ln -s /usr/bin/php8.0 /opt/buildhome/.php/php
409
+
392
410
ENV PATH "/opt/buildhome/.php:$PATH"
393
411
394
412
# ###############################################################################
@@ -414,14 +432,19 @@ RUN gimme | bash
414
432
# Dotnet Core
415
433
#
416
434
# ###############################################################################
435
+
417
436
WORKDIR /tmp
437
+
418
438
ENV DOTNET_VERSION 6.0
419
- RUN wget https://dot.net/v1/dotnet-install.sh
420
- RUN chmod u+x /tmp/dotnet-install.sh
421
- RUN /tmp/dotnet-install.sh -c ${DOTNET_VERSION}
439
+
440
+ RUN wget --quiet https://dot.net/v1/dotnet-install.sh && \
441
+ chmod u+x /tmp/dotnet-install.sh && \
442
+ /tmp/dotnet-install.sh -c ${DOTNET_VERSION}
443
+
422
444
ENV PATH "$PATH:/opt/buildhome/.dotnet/tools"
423
445
ENV PATH "$PATH:/opt/buildhome/.dotnet"
424
446
ENV DOTNET_ROOT "/opt/buildhome/.dotnet"
447
+
425
448
# populate local package cache
426
449
RUN dotnet new
427
450
@@ -438,20 +461,24 @@ ENV PATH "$SWIFTENV_ROOT/bin:$SWIFTENV_ROOT/shims:$PATH"
438
461
# ###############################################################################
439
462
#
440
463
# Homebrew
464
+ # only available for amd64 images NOT inside arm64
441
465
#
442
466
# ###############################################################################
467
+
443
468
USER root
469
+
444
470
RUN mkdir -p /home/linuxbrew/.linuxbrew && chown -R buildbot /home/linuxbrew/
471
+
445
472
USER buildbot
446
- RUN /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
473
+ RUN if [ "$TARGETARCH" = "amd64" ] ; then /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" ; fi
474
+
447
475
ENV HOMEBREW_PREFIX "/home/linuxbrew/.linuxbrew"
448
476
ENV PATH "${HOMEBREW_PREFIX}/bin:${PATH}"
449
477
ENV HOMEBREW_CELLAR "${HOMEBREW_PREFIX}/Cellar"
450
478
ENV HOMEBREW_REPOSITORY "${HOMEBREW_PREFIX}/Homebrew"
451
479
ENV HOMEBREW_CACHE "/opt/buildhome/.homebrew-cache"
452
- RUN brew tap homebrew/bundle
453
480
454
- WORKDIR /
481
+ RUN if [ "$TARGETARCH" = "amd64" ] ; then brew tap homebrew/bundle; fi
455
482
456
483
# ###############################################################################
457
484
#
@@ -461,29 +488,22 @@ WORKDIR /
461
488
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain none
462
489
ENV PATH "$PATH:/opt/buildhome/.cargo/bin"
463
490
464
- # Cleanup
491
+ # ###############################################################################
492
+ #
493
+ # Cleanup 🧹
494
+ #
495
+ # ###############################################################################
465
496
USER root
466
497
467
498
# Add buildscript for local testing
468
499
RUN mkdir -p /opt/build-bin
469
- ADD run-build-functions.sh /opt/build-bin/run-build-functions.sh
470
- ADD run-build.sh /opt/build-bin/build
471
- ADD buildbot-git-config /root/.gitconfig
500
+ COPY run-build-functions.sh /opt/build-bin/run-build-functions.sh
501
+ COPY run-build.sh /opt/build-bin/build
502
+ COPY buildbot-git-config /root/.gitconfig
472
503
RUN rm -r /tmp/*
473
504
474
505
USER buildbot
475
- # The semver version associated with this build (i.e. v3.0.0)
476
- ARG NF_IMAGE_VERSION
477
- ENV NF_IMAGE_VERSION ${NF_IMAGE_VERSION:-latest}
478
-
479
- # The commit SHA tag associated with this build
480
- ARG NF_IMAGE_TAG
481
- ENV NF_IMAGE_TAG ${NF_IMAGE_TAG:-latest}
482
-
483
- # The codename associated with this build (i.e. focal)
484
- ARG NF_IMAGE_NAME
485
- ENV NF_IMAGE_NAME ${NF_IMAGE_NAME:-focal}
486
-
506
+ WORKDIR /
487
507
488
508
# ###############################################################################
489
509
#
@@ -496,15 +516,15 @@ FROM build-image as build-image-test
496
516
USER buildbot
497
517
SHELL ["/bin/bash" , "-c" ]
498
518
499
- ADD --chown=buildbot:buildbot package.json /opt/buildhome/test-env/package.json
519
+ COPY --chown=buildbot:buildbot package.json /opt/buildhome/test-env/package.json
500
520
501
521
# We need to install with `--legacy-peer-deps` because of:
502
522
# https://github.com/bats-core/bats-assert/issues/27
503
523
RUN cd /opt/buildhome/test-env && . ~/.nvm/nvm.sh && npm i --legacy-peer-deps &&\
504
524
ln -s /opt/build-bin/run-build-functions.sh /opt/buildhome/test-env/run-build-functions.sh &&\
505
525
ln -s /opt/build-bin/build /opt/buildhome/test-env/run-build.sh
506
526
507
- ADD --chown=buildbot:buildbot tests /opt/buildhome/test-env/tests
527
+ COPY --chown=buildbot:buildbot tests /opt/buildhome/test-env/tests
508
528
WORKDIR /opt/buildhome/test-env
509
529
510
530
# Set `bats` as entrypoint
0 commit comments