From 248f75c777ee31f2b333c016ac34010c7260c308 Mon Sep 17 00:00:00 2001 From: "Lumberbot (aka Jack)" <39504233+meeseeksmachine@users.noreply.github.com> Date: Thu, 19 Sep 2024 16:03:11 -0700 Subject: [PATCH] chore(backport): Apply Docker build check corrections (#2544) * Backport PR https://github.com/scikit-hep/pyhf/pull/2543 * Apply revisions to Dockerfile from Docker build checks. - https://docs.docker.com/reference/build-checks/from-as-casing/ - https://docs.docker.com/go/dockerfile/rule/undefined-var/ - https://docs.docker.com/go/dockerfile/rule/legacy-key-value-format/ --- docker/Dockerfile | 9 +++++---- docker/gpu/Dockerfile | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 47ff491ea6..3f1a51df8e 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,8 +1,8 @@ ARG BASE_IMAGE=python:3.12-slim-bullseye # hadolint ignore=DL3006 -FROM ${BASE_IMAGE} as base +FROM ${BASE_IMAGE} AS base -FROM base as builder +FROM base AS builder # Set PATH to pickup virtual environment by default ENV PATH=/usr/local/venv/bin:"${PATH}" COPY . /code @@ -49,10 +49,11 @@ RUN adduser \ COPY --from=builder --chown=moby /usr/local/venv /usr/local/venv/ +# Does NOT define USER as ENV USER moby -ENV USER ${USER} -ENV HOME /home/moby +ENV USER=moby +ENV HOME=/home/moby WORKDIR ${HOME}/work # Use C.UTF-8 locale to avoid issues with ASCII encoding diff --git a/docker/gpu/Dockerfile b/docker/gpu/Dockerfile index 0bc93597bc..af1e83597c 100644 --- a/docker/gpu/Dockerfile +++ b/docker/gpu/Dockerfile @@ -1,6 +1,6 @@ -FROM nvidia/cuda:10.1-cudnn7-runtime-ubuntu18.04 as base +FROM nvidia/cuda:10.1-cudnn7-runtime-ubuntu18.04 AS base -FROM base as builder +FROM base AS builder # hadolint ignore=DL3015 RUN apt-get update -y && \ apt-get install -y \