From eb44f8c78537517d4515bc6d04feac0361b1e58e Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Thu, 19 Sep 2024 17:53:51 -0500 Subject: [PATCH] chore: Apply Docker build check corrections (#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 1e81d375c4..6c4e62eb31 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 @@ -48,10 +48,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 7c4a3ab3ae..288ef916f2 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 \