From e697fa067c41419b746ec91746945c1dba3ee5c2 Mon Sep 17 00:00:00 2001 From: Andri Joos <andri@joos.io> Date: Tue, 3 Dec 2024 22:01:48 +0100 Subject: [PATCH] add multi version image --- .gitlab-ci.yml | 7 +++++-- .vscode/tasks.json | 35 ++++++++++++++++++++++++++++++----- Dockerfile | 4 +++- 3 files changed, 38 insertions(+), 8 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a742db5..bfa212b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -3,8 +3,11 @@ include: ref: master file: devcontainer_images.gitlab-ci.yml -build: +variables: + IMAGE_BASENAME: ${IMAGE_PREFIX}/devcontainer-dotnet + +"8.0": extends: .build_image_job_template variables: - IMAGE_BASENAME: ${IMAGE_PREFIX}/devcontainer-dotnet IMAGE_NAME: ${IMAGE_BASENAME}:8.0 + BUILD_ARGS: DOTNET_VERSION=8.0 diff --git a/.vscode/tasks.json b/.vscode/tasks.json index ed4a0aa..7208806 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -4,12 +4,37 @@ "version": "2.0.0", "tasks": [ { - "label": "docker build", + "label": "build", "command": "docker", "args": [ "build", - "." - ] - } - ] + "--build-arg", + "DOTNET_VERSION=${input:dotnetVersion}", + ".", + ], + }, + { + "label": "buildx build", + "command": "docker", + "args": [ + "buildx", + "build", + "--build-arg", + "DOTNET_VERSION=${input:dotnetVersion}", + "--platform", + "linux/arm64,linux/amd64", + ".", + ], + }, + ], + "inputs": [ + { + "id": "dotnetVersion", + "type": "pickString", + "description": "Choose dotnet image version", + "options": [ + "8.0", + ], + }, + ], } diff --git a/Dockerfile b/Dockerfile index 40c7e96..3760c71 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,6 @@ -FROM mcr.microsoft.com/dotnet/sdk:8.0 +ARG DOTNET_VERSION="8.0" + +FROM mcr.microsoft.com/dotnet/sdk:${DOTNET_VERSION} ARG USERNAME="vscode" ARG USER_UID="1000" -- GitLab