Here is an alternative approach to finding an explicit metric on the cone $CX$.
Let us first assume that $X$ is a subset of a normed linear space $(E, \lVert - \rVert)$ and the metric $d$ on $X$ is given by $d(x,y) = \lVert x - y \rVert$. Define the geometric cone over $X$ as the subset $C'X \subset E' = E \times \mathbb R$ obtained by taking the union all lines segments $L(x) = \{((1-t)x,t) \mid t \in I \} \subset E'$, $x \in X$, connecting $(x,0)$ with $(0,1)$. In other words
$$C'X = \{(1-t)x,t) \mid x \in x, t \in I \} .$$
Then $C'X$ is a subset of the normed linear space $(E', \lVert - \rVert')$ where $\lVert (x,t) \rVert' = \lVert x \rVert + \lvert t \rvert$ and therefore inherits a metric $d'$ given by $d'((x,t),(y,s)) = \lVert ((x,t) - (y,s)) \rVert' = \lVert x - y \rVert + \lvert t - s \rvert$.
Now define
$$\varphi : X \times I \to C'X, \varphi(x,t) = ((1-t)x,t).$$
This is a continuous map such that $\varphi(X \times \{ 1\}) = \{ (0,1) \}$, hence it induces a continuous $\phi : CX \to C'X$ which is obviously a bijection. If $X$ is compact, then $\phi$ is a homeomorphism. Hence $CX$ can be endowed with the metric
$$D([x,t],[(y,s]) = d'(\phi([x,t]),\phi([y,s])) = d'(\varphi(x,t),\varphi(y,s)) \\ = \lVert (1-t)x -(1-s)y \rVert + \lvert t - s \rvert$$
that induces its usual topology.
Now let $(X,d)$ be a metric space with a bounded metric $d$. If $X$ is compact, then $d$ is automatically bounded. Let $C_b(X)$ be the vector space of all continuous bounded maps $f :X \to \mathbb R$ which is endowed with the $\sup$-norm $\lVert f \rVert = \sup_{x\in X} \lvert f(x) \rvert$. It is well-known that $(X,d)$ embeds isometrically into $(C_b(X),\lVert - \rVert)$ via $x \mapsto e(x) = d(x,-) : X \to \mathbb R$. The proof is straightforward. Identifying $X$ with $e(X) \subset C_b(X)$, our above construction yields a geometric cone $C'X$ with metric $d'$. If $X$ is compact, this yields the following metric on $CX$:
$$D([x,t],[y,s]) = \sup_{z \in X} \lvert (1-t)d(x,z) - (1-s)d(y,z) \rvert + \lvert t -s \rvert .$$
This is admittedly less transparent than Eric Wofsey's solution.
Let us close with a remark concerning the geometric cone. If $X$ is not compact, then $C'X$ is not homeomorphic to $CX$. In fact, $CX$ does not have a countable neighborhoood base at its tip whereas $C'X$ is first countable. See my answer to Equivalent definition $\text{Cone}(K)$ which can be generalized to the present case.
Nevertheless, $C'X$ has some essential features attributed to a cone: It is contractible and the inclusion $X \to C'X, x \mapsto (x,0)$, is a cofibration.
Best Answer
The general outline is to write your given compact metric space $A$ as a decomposition into two sets, then four sets, then eight sets, etc., in the exact same fashion that the Cantor set is decomposed, except that whereas the decomposition elements of the Cantor set are pairwise disjoint, the decomposition elements in $A$ need not be pairwise disjoint. Be careful about how your decomposition elements are indexed. Once similarly indexed decomposition elements of $C$ and of $A$ are put side-by-side, the formula for writing the desired function $C \mapsto A$ is evident.
Here's a few details.
For any compact metric space $A$, you can write it as a union of two compact subsets $$A = A_0 \cup A_1 $$ and then for each $i_1 \in \{0,1\}$ you can write $A_{i_1}$ as a union of two compact subsets $$A_{i_1} = A_{i_1,0} \cup A_{i_1,1} $$ and then for each $i_1,i_2 \in \{0,1\}$ you can write $A_{i_1,i_2}$ as a union of two compact subsets $$A_{i_1,i_2} = A_{i_1,i_2,0} \cup A_{i_1,i_2,1} $$ and so on and so on inductively, so that as the length of the subscript sequence increases, the diameter of the set decreases to zero. It follows for any infinite sequence $\omega = (i_1,i_2,i_3,...)$ of $0$'s and $1$'s the nested decreasing intersection $$A_\omega = A_{i_1} \cap A_{i_1, i_2} \cap A_{i_1, i_2, i_3} \cap \cdots $$ is a single point.
Then you take the usual description of the Cantor set $C$ as the set of real numbers $x$ written in trinary as $$x = .j_1 j_2 j_3 \cdots $$ where $j_n \in \{0,2\}$, let $i_n = j_n/2 \in \{0,1\}$, let $\omega(x) = (i_1,i_2,i_3,...)$, and map $x$ to the point $A_{\omega(x)}$.