Fix Docker warning about deprecated ENV usage (#2893)

This commit is contained in:
Alexandre Hamez 2024-12-12 14:37:12 +01:00 committed by GitHub
parent 8694330911
commit cd46b5c667
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 33 additions and 33 deletions

View file

@ -10,11 +10,11 @@ You can deploy Livebook inside your infrastructure using Docker. The Dockerfile
FROM ghcr.io/livebook-dev/livebook FROM ghcr.io/livebook-dev/livebook
# Configure your port accordingly # Configure your port accordingly
ENV LIVEBOOK_PORT 7860 ENV LIVEBOOK_PORT=7860
EXPOSE 7860 EXPOSE 7860
# If you have a persistent volume, configure it here # If you have a persistent volume, configure it here
ENV LIVEBOOK_DATA_PATH "/data" ENV LIVEBOOK_DATA_PATH="/data"
USER root USER root
RUN mkdir -p /data RUN mkdir -p /data
RUN chmod 777 /data RUN chmod 777 /data
@ -147,4 +147,4 @@ If you are using [Livebook Teams](https://livebook.dev/teams/), you can also dep
The deployment steps will show you to deploy your notebooks within Docker, Fly.io, and Kubernetes. This is effectively done by setting the `LIVEBOOK_TEAMS_AUTH`, which configures Livebook to run as a read-only instance connected to Livebook Teams. The deployment steps will show you to deploy your notebooks within Docker, Fly.io, and Kubernetes. This is effectively done by setting the `LIVEBOOK_TEAMS_AUTH`, which configures Livebook to run as a read-only instance connected to Livebook Teams.
Livebook Teams also support airgapped deployments, pre-configured environment variables, shared team secrets, file storages, and more. Livebook Teams also support airgapped deployments, pre-configured environment variables, shared team secrets, file storages, and more.

View file

@ -11,7 +11,7 @@ To do this in Docker, you will need to build it differently. Below is an example
```docker ```docker
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.9-1137 FROM registry.access.redhat.com/ubi8/ubi-minimal:8.9-1137
# Set environment variables for path and language # Set environment variables for path and language
ENV PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
# Install system dependencies and clean cache in one layer # Install system dependencies and clean cache in one layer
RUN microdnf install -y unzip autoconf git ncurses-devel openssl-devel gcc gcc-c++ make automake perl clang wget tar cmake glibc-locale-source glibc-langpack-en && \ RUN microdnf install -y unzip autoconf git ncurses-devel openssl-devel gcc gcc-c++ make automake perl clang wget tar cmake glibc-locale-source glibc-langpack-en && \

View file

@ -115,18 +115,18 @@ defmodule Livebook.Hubs.Dockerfile do
"auto" -> "auto" ->
""" """
# Clustering configuration (note that we need the same Livebook secrets across all nodes) # Clustering configuration (note that we need the same Livebook secrets across all nodes)
ENV LIVEBOOK_CLUSTER "auto" ENV LIVEBOOK_CLUSTER="auto"
ENV LIVEBOOK_SECRET_KEY_BASE "#{secret_key_base}" ENV LIVEBOOK_SECRET_KEY_BASE="#{secret_key_base}"
ENV LIVEBOOK_COOKIE "#{cookie}" ENV LIVEBOOK_COOKIE="#{cookie}"
""" """
"dns" -> "dns" ->
""" """
# Clustering configuration (note that we need the same Livebook secrets across all nodes) # Clustering configuration (note that we need the same Livebook secrets across all nodes)
ENV LIVEBOOK_NODE "livebook_server@MACHINE_IP" ENV LIVEBOOK_NODE="livebook_server@MACHINE_IP"
ENV LIVEBOOK_CLUSTER "dns:QUERY" ENV LIVEBOOK_CLUSTER="dns:QUERY"
ENV LIVEBOOK_SECRET_KEY_BASE "#{secret_key_base}" ENV LIVEBOOK_SECRET_KEY_BASE="#{secret_key_base}"
ENV LIVEBOOK_COOKIE "#{cookie}" ENV LIVEBOOK_COOKIE="#{cookie}"
""" """
_ -> _ ->
@ -135,8 +135,8 @@ defmodule Livebook.Hubs.Dockerfile do
apps_config = """ apps_config = """
# Apps configuration # Apps configuration
ENV LIVEBOOK_APPS_PATH "/apps" ENV LIVEBOOK_APPS_PATH="/apps"
ENV LIVEBOOK_APPS_PATH_WARMUP "manual" ENV LIVEBOOK_APPS_PATH_WARMUP="manual"
""" """
notebook = notebook =
@ -210,21 +210,21 @@ defmodule Livebook.Hubs.Dockerfile do
ARG TEAMS_KEY="#{hub.teams_key}" ARG TEAMS_KEY="#{hub.teams_key}"
# Teams Hub configuration for airgapped deployment # Teams Hub configuration for airgapped deployment
ENV LIVEBOOK_TEAMS_KEY ${TEAMS_KEY} ENV LIVEBOOK_TEAMS_KEY=${TEAMS_KEY}
ENV LIVEBOOK_TEAMS_AUTH "offline:#{hub.hub_name}:#{hub.org_public_key}" ENV LIVEBOOK_TEAMS_AUTH="offline:#{hub.hub_name}:#{hub.org_public_key}"
""" """
secrets = secrets =
if used_secrets != [] do if used_secrets != [] do
""" """
ENV LIVEBOOK_TEAMS_SECRETS "#{encrypt_secrets_to_dockerfile(used_secrets, hub)}" ENV LIVEBOOK_TEAMS_SECRETS="#{encrypt_secrets_to_dockerfile(used_secrets, hub)}"
""" """
end end
file_systems = file_systems =
if hub_file_systems != [] do if hub_file_systems != [] do
""" """
ENV LIVEBOOK_TEAMS_FS "#{encrypt_file_systems_to_dockerfile(hub_file_systems, hub)}" ENV LIVEBOOK_TEAMS_FS="#{encrypt_file_systems_to_dockerfile(hub_file_systems, hub)}"
""" """
end end
@ -248,7 +248,7 @@ defmodule Livebook.Hubs.Dockerfile do
defp format_envs(list) do defp format_envs(list) do
Enum.map_join(list, fn {key, value} -> Enum.map_join(list, fn {key, value} ->
~s/ENV #{key} "#{String.replace(value, ~S["], ~S[\"])}"\n/ ~s/ENV #{key}="#{String.replace(value, ~S["], ~S[\"])}"\n/
end) end)
end end

View file

@ -23,8 +23,8 @@ defmodule Livebook.Hubs.DockerfileTest do
FROM ghcr.io/livebook-dev/livebook:#{@version} FROM ghcr.io/livebook-dev/livebook:#{@version}
# Apps configuration # Apps configuration
ENV LIVEBOOK_APPS_PATH "/apps" ENV LIVEBOOK_APPS_PATH="/apps"
ENV LIVEBOOK_APPS_PATH_WARMUP "manual" ENV LIVEBOOK_APPS_PATH_WARMUP="manual"
# Notebook # Notebook
COPY notebook.livemd /apps/ COPY notebook.livemd /apps/
@ -48,7 +48,7 @@ defmodule Livebook.Hubs.DockerfileTest do
assert dockerfile =~ assert dockerfile =~
""" """
# Personal Hub secrets # Personal Hub secrets
ENV LB_TEST "test" ENV LB_TEST="test"
""" """
refute dockerfile =~ "ENV LB_SESSION" refute dockerfile =~ "ENV LB_SESSION"
@ -81,8 +81,8 @@ defmodule Livebook.Hubs.DockerfileTest do
assert dockerfile =~ assert dockerfile =~
""" """
# Personal Hub secrets # Personal Hub secrets
ENV LB_TEST "test" ENV LB_TEST="test"
ENV LB_TEST2 "test" ENV LB_TEST2="test"
""" """
refute dockerfile =~ "ENV LB_SESSION" refute dockerfile =~ "ENV LB_SESSION"
@ -101,12 +101,12 @@ defmodule Livebook.Hubs.DockerfileTest do
ARG TEAMS_KEY="lb_tk_fn0pL3YLWzPoPFWuHeV3kd0o7_SFuIOoU4C_k6OWDYg" ARG TEAMS_KEY="lb_tk_fn0pL3YLWzPoPFWuHeV3kd0o7_SFuIOoU4C_k6OWDYg"
# Teams Hub configuration for airgapped deployment # Teams Hub configuration for airgapped deployment
ENV LIVEBOOK_TEAMS_KEY ${TEAMS_KEY} ENV LIVEBOOK_TEAMS_KEY=${TEAMS_KEY}
ENV LIVEBOOK_TEAMS_AUTH "offline:org-name-387:lb_opk_fpxnp3r5djwxnmirx3tu276hialoivf3" ENV LIVEBOOK_TEAMS_AUTH="offline:org-name-387:lb_opk_fpxnp3r5djwxnmirx3tu276hialoivf3"
# Apps configuration # Apps configuration
ENV LIVEBOOK_APPS_PATH "/apps" ENV LIVEBOOK_APPS_PATH="/apps"
ENV LIVEBOOK_APPS_PATH_WARMUP "manual" ENV LIVEBOOK_APPS_PATH_WARMUP="manual"
# Notebook # Notebook
COPY notebook.livemd /apps/ COPY notebook.livemd /apps/
@ -191,7 +191,7 @@ defmodule Livebook.Hubs.DockerfileTest do
dockerfile = Dockerfile.airgapped_dockerfile(config, hub, [], [], file, [], %{}) dockerfile = Dockerfile.airgapped_dockerfile(config, hub, [], [], file, [], %{})
assert dockerfile =~ ~s/ENV LIVEBOOK_CLUSTER "auto"/ assert dockerfile =~ ~s/ENV LIVEBOOK_CLUSTER="auto"/
end end
test "deploying with dns cluster setup" do test "deploying with dns cluster setup" do
@ -201,8 +201,8 @@ defmodule Livebook.Hubs.DockerfileTest do
dockerfile = Dockerfile.airgapped_dockerfile(config, hub, [], [], file, [], %{}) dockerfile = Dockerfile.airgapped_dockerfile(config, hub, [], [], file, [], %{})
assert dockerfile =~ ~s/ENV LIVEBOOK_NODE "livebook_server@MACHINE_IP"/ assert dockerfile =~ ~s/ENV LIVEBOOK_NODE="livebook_server@MACHINE_IP"/
assert dockerfile =~ ~s/ENV LIVEBOOK_CLUSTER "dns:QUERY"/ assert dockerfile =~ ~s/ENV LIVEBOOK_CLUSTER="dns:QUERY"/
end end
test "deploying with deployment group environment variables" do test "deploying with deployment group environment variables" do
@ -222,9 +222,9 @@ defmodule Livebook.Hubs.DockerfileTest do
assert dockerfile =~ """ assert dockerfile =~ """
# Deployment group environment variables # Deployment group environment variables
ENV LIVEBOOK_IDENTITY_PROVIDER "cloudflare:foobar" ENV LIVEBOOK_IDENTITY_PROVIDER="cloudflare:foobar"
ENV LIVEBOOK_TEAMS_URL "http://localhost:8000" ENV LIVEBOOK_TEAMS_URL="http://localhost:8000"
ENV MY_JSON "{\\"foo\\": \\"bar\\"}"\ ENV MY_JSON="{\\"foo\\": \\"bar\\"}"\
""" """
end end
end end