Skip to content

Commit

Permalink
fix: Use newer syntax for ENV variables
Browse files Browse the repository at this point in the history
Current versions of Docker Desktop will output a LegacyKeyValueFormat
warning when using 'ENV key value' syntax. We switch to the updated 'ENV
key=value' syntax.

Signed-off-by: Andrew Bobulsky <[email protected]>
  • Loading branch information
RulerOf committed Jul 31, 2024
1 parent 057465d commit 364aad7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
12 changes: 6 additions & 6 deletions lib/kitchen/docker/helpers/container_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -153,18 +153,18 @@ def remove_container(state)
def dockerfile_proxy_config
env_variables = ""
if config[:http_proxy]
env_variables << "ENV http_proxy #{config[:http_proxy]}\n"
env_variables << "ENV HTTP_PROXY #{config[:http_proxy]}\n"
env_variables << "ENV http_proxy=#{config[:http_proxy]}\n"
env_variables << "ENV HTTP_PROXY=#{config[:http_proxy]}\n"
end

if config[:https_proxy]
env_variables << "ENV https_proxy #{config[:https_proxy]}\n"
env_variables << "ENV HTTPS_PROXY #{config[:https_proxy]}\n"
env_variables << "ENV https_proxy=#{config[:https_proxy]}\n"
env_variables << "ENV HTTPS_PROXY=#{config[:https_proxy]}\n"
end

if config[:no_proxy]
env_variables << "ENV no_proxy #{config[:no_proxy]}\n"
env_variables << "ENV NO_PROXY #{config[:no_proxy]}\n"
env_variables << "ENV no_proxy=#{config[:no_proxy]}\n"
env_variables << "ENV NO_PROXY=#{config[:no_proxy]}\n"
end

env_variables
Expand Down
18 changes: 9 additions & 9 deletions lib/kitchen/docker/helpers/dockerfile_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ def debian_platform
&& ln -sf /bin/true /sbin/initctl
CODE
packages = <<-CODE
ENV DEBIAN_FRONTEND noninteractive
ENV container docker
ENV DEBIAN_FRONTEND=noninteractive
ENV container=docker
RUN apt-get update
RUN apt-get install -y sudo openssh-server curl lsb-release
CODE
Expand All @@ -78,7 +78,7 @@ def debian_platform

def fedora_platform
<<-CODE
ENV container docker
ENV container=docker
RUN dnf clean all
RUN dnf install -y sudo openssh-server openssh-clients which curl
RUN [ -f "/etc/ssh/ssh_host_rsa_key" ] || ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -N ''
Expand Down Expand Up @@ -106,15 +106,15 @@ def gentoo_paludis_platform

def opensuse_platform
<<-CODE
ENV container docker
ENV container=docker
RUN zypper install -y sudo openssh which curl gawk
RUN /usr/sbin/sshd-gen-keys-start
CODE
end

def rhel_platform
<<-CODE
ENV container docker
ENV container=docker
RUN yum clean all
RUN yum install -y sudo openssh-server openssh-clients which curl
RUN [ -f "/etc/ssh/ssh_host_rsa_key" ] || ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -N ''
Expand All @@ -124,7 +124,7 @@ def rhel_platform

def centosstream_platform
<<-CODE
ENV container docker
ENV container=docker
RUN yum clean all
RUN yum install -y sudo openssh-server openssh-clients which
RUN [ -f "/etc/ssh/ssh_host_rsa_key" ] || ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -N ''
Expand All @@ -134,7 +134,7 @@ def centosstream_platform

def almalinux_platform
<<-CODE
ENV container docker
ENV container=docker
RUN yum clean all
RUN yum install -y sudo openssh-server openssh-clients which
RUN [ -f "/etc/ssh/ssh_host_rsa_key" ] || ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -N ''
Expand All @@ -144,7 +144,7 @@ def almalinux_platform

def rockylinux_platform
<<-CODE
ENV container docker
ENV container=docker
RUN yum clean all
RUN yum install -y sudo openssh-server openssh-clients which
RUN [ -f "/etc/ssh/ssh_host_rsa_key" ] || ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -N ''
Expand All @@ -154,7 +154,7 @@ def rockylinux_platform

def photonos_platform
<<-CODE
ENV container docker
ENV container=docker
RUN tdnf clean all
RUN tdnf install -y sudo openssh-server openssh-clients which curl
RUN [ -f "/etc/ssh/ssh_host_ecdsa_key" ] || ssh-keygen -t ecdsa -f /etc/ssh/ssh_host_ecdsa_key -N ''
Expand Down

0 comments on commit 364aad7

Please sign in to comment.