You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use secrets instead of command line arguments to pass license key (#4577) (#4578)
* Use secrets instead of command line arguments to pass license key
* Add examples for Powershell and Bash
Co-authored-by: Petter Holmström <petter@vaadin.com>
The `--build-arg` option works because the provided `Dockerfile` in the walking skeleton already defines and forwards the `VAADIN_PRPO_KEY` argument:
72
-
73
-
[source,docker]
74
-
----
75
-
ARG VAADIN_PRO_KEY
76
-
ENV VAADIN_PRO_KEY=${VAADIN_PRO_KEY}
77
-
----
78
-
79
-
The `ARG` instruction declares a build-time argument, while the `ENV` instruction makes it available as an environment variable inside the container during the build.
80
-
====
81
-
82
-
==== Create a Script
83
-
84
-
Manually copying the key each time can be inconvenient. You can automate this by creating a shell or PowerShell script that retrieves the key from `$HOME/.vaadin/proKey`:
61
+
When building locally with Maven, the Vaadin Maven plugin detects the license automatically. For Docker builds, you must pass the key explicitly as a secret:
85
62
86
63
[.example]
87
64
--
88
-
.build.sh
89
65
[source,bash,subs="+attributes"]
90
66
----
91
67
<source-info group="macOS / Linux"></source-info>
92
-
#!/usr/bin/env bash
93
-
VAADIN_PRO_KEY=""
94
-
PRO_KEY_FILE="$HOME/.vaadin/proKey"
95
-
DOCKER_TAG=""
96
-
97
-
if [ $# -gt 0 ]; then
98
-
DOCKER_TAG="$1"
99
-
else
100
-
echo "Usage: ./build.sh <tag-name>"
101
-
exit 1
102
-
fi
103
-
104
-
if [ -f "$PRO_KEY_FILE" ]; then
105
-
if VAADIN_PRO_KEY=$(jq -r '.proKey // empty' "$PRO_KEY_FILE" 2>/dev/null) && [ -n "$VAADIN_PRO_KEY" ]; then
106
-
echo "Found Vaadin Pro key"
107
-
else
108
-
echo "Could not parse Vaadin Pro key from $PRO_KEY_FILE" >&2
109
-
fi
110
-
else
111
-
echo "No Vaadin Pro key found at $PRO_KEY_FILE (continuing without it)"
0 commit comments