Docker devcontainer Alpine problem downloading XTC Tools

New to XMOS and XCore? Get started here.
PVS_Bram
Member++
Posts: 18
Joined: Fri Jan 12, 2024 11:20 am

Docker devcontainer Alpine problem downloading XTC Tools

Post by PVS_Bram »

Hi everyone,

I am trying to set up a development environment in a Docker Container in its own volume starting from a Alpine Linux image. This way a reproducible and fast build environment can be created.

The problem I am running in to is downloading the XTC Tools file from the XMOS site. Downloading the file requires the user to be logged in, if the user is not logged in. "wget"-, "curl"-package and ADD(Dockerfile) are not able to retrieve the *.tgz file. The function just returns the html login page. Is there any work around? Is there any official mirror link that supports a direct download? Passing the --username and --password argument in both the wget and curl does not solve the issue. The following code snippets show the basic Dockerfile and the commands that I have tried to retrieve the .tgz file.

Simplified Dockerfile:

Code: Select all

FROM alpine:3.18.5
RUN apk add --no-cache &&\
	apk add wget &&\
	apk add curl
wget tries:

Code: Select all

wget "https://www.xmos.com/download/Tools-15---Linux-64(15_2_1).tgz"
wget --user=USERNAME --password=PASSWORD "https://www.xmos.com/download/Tools-15---Linux-64(15_2_1).tgz"
curl tries:

Code: Select all

curl -L "https://www.xmos.com/download/Tools-15---Linux-64(15_2_1).tgz"
curl -LO -A "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3" "https://www.xmos.com/download/Tools-15---Linux-64(15_2_1).tgz"
curl --data "Username=xx&Password=xx&Login=Login" "https://www.xmos.com/download/Tools-15---Linux-64(15_2_1).tgz"
Dockerfile tries:

Code: Select all

ADD "https://www.xmos.com/download/Tools-15---Linux-64(15_2_1).tgz" .
Regardless of the command, it would be better that a username and/or password should not be passed as a command line argument due to security risks. It can be added as a secret in Docker but this just unnecessary complicates download a toolchain.

Kind regards.
PVS_Bram
Member++
Posts: 18
Joined: Fri Jan 12, 2024 11:20 am

Post by PVS_Bram »

I managed to provide a temporary fix to the issue I am having. Not by downloading but by passing the *.tgz file as an argument in the "devcontainer.json". In the .devcontainer folder the following files: "devcontainer.json", "Dockerfile" and "Tools-15---Linux-64_15_2_1.tgz"

devcontainer.json

Code: Select all

{
	"name": "XMOS Development Container",
	"build": {
		"dockerfile": "Dockerfile",
        	"args": {
            		"package": "Tools-15---Linux-64_15_1_4.tgz"
        	}
	}
}
Dockerfile

Code: Select all

FROM alpine:3.18.5

RUN apk add --no-cache # &&\
    #apk add tar &&\
    #apk add curl

ADD $package ./
The package is than available at the ./ location ready to be used. Although that this works, it is not the solution that I would like to have... I would still like the option to have the download link.