+
+ This stack will be deployed using the equivalent of docker-compose
. Only Compose file format version 2 is supported at the moment.
+
+
+ This stack will be deployed using docker-compose
.
+
You can get more information about Compose file format in the official documentation.
diff --git a/app/portainer/views/stacks/edit/stackController.js b/app/portainer/views/stacks/edit/stackController.js
index 1ea4a8cb0..c7e01dc15 100644
--- a/app/portainer/views/stacks/edit/stackController.js
+++ b/app/portainer/views/stacks/edit/stackController.js
@@ -359,7 +359,7 @@ angular.module('portainer.app').controller('StackController', [
});
}
- function initView() {
+ async function initView() {
var stackName = $transition$.params().name;
$scope.stackName = stackName;
var external = $transition$.params().external;
@@ -372,6 +372,15 @@ angular.module('portainer.app').controller('StackController', [
var stackId = $transition$.params().id;
loadStack(stackId);
}
+
+ try {
+ const endpoint = EndpointProvider.currentEndpoint();
+ $scope.composeSyntaxMaxVersion = endpoint.ComposeSyntaxMaxVersion;
+ } catch (err) {
+ Notifications.error('Failure', err, 'Unable to retrieve the ComposeSyntaxMaxVersion');
+ }
+
+ $scope.stackType = $transition$.params().type;
}
initView();
diff --git a/build/download_docker_compose_binary.ps1 b/build/download_docker_compose_binary.ps1
new file mode 100755
index 000000000..bfafaa52b
--- /dev/null
+++ b/build/download_docker_compose_binary.ps1
@@ -0,0 +1,8 @@
+param (
+ [string]$docker_compose_version
+)
+
+$ErrorActionPreference = "Stop";
+$ProgressPreference = "SilentlyContinue";
+
+Invoke-WebRequest -O "dist/docker-compose.exe" "https://github.com/docker/compose/releases/download/$($docker_compose_version)/docker-compose-Windows-x86_64.exe"
diff --git a/build/download_docker_compose_binary.sh b/build/download_docker_compose_binary.sh
new file mode 100755
index 000000000..96a963060
--- /dev/null
+++ b/build/download_docker_compose_binary.sh
@@ -0,0 +1,15 @@
+#!/usr/bin/env bash
+
+PLATFORM=$1
+ARCH=$2
+DOCKER_COMPOSE_VERSION=$3
+
+if [ "${PLATFORM}" == 'linux' ] && [ "${ARCH}" == 'amd64' ]; then
+ wget -O "dist/docker-compose" "https://github.com/portainer/docker-compose-linux-amd64-static-binary/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose"
+ chmod +x "dist/docker-compose"
+elif [ "${PLATFORM}" == 'mac' ]; then
+ wget -O "dist/docker-compose" "https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-Darwin-x86_64"
+ chmod +x "dist/docker-compose"
+fi
+
+exit 0
diff --git a/build/windows2016/nanoserver/Dockerfile b/build/windows2016/nanoserver/Dockerfile
index 799071182..851e97540 100644
--- a/build/windows2016/nanoserver/Dockerfile
+++ b/build/windows2016/nanoserver/Dockerfile
@@ -1,12 +1,24 @@
FROM mcr.microsoft.com/windows/servercore:ltsc2019 as core
+
+ENV GIT_VERSION 2.30.0
+ENV GIT_PATCH_VERSION 2
+
+RUN powershell -Command $ErrorActionPreference = 'Stop' ; \
+ [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 ; \
+ Invoke-WebRequest $('https://github.com/git-for-windows/git/releases/download/v{0}.windows.{1}/MinGit-{0}.{1}-busybox-64-bit.zip' -f $env:GIT_VERSION, $env:GIT_PATCH_VERSION) -OutFile 'mingit.zip' -UseBasicParsing ; \
+ Expand-Archive mingit.zip -DestinationPath c:\mingit
+
FROM mcr.microsoft.com/windows/nanoserver:1809-amd64
USER ContainerAdministrator
COPY --from=core /windows/system32/netapi32.dll /windows/system32/netapi32.dll
+COPY --from=core /mingit /mingit
COPY dist /
+RUN setx /M path "C:\mingit\cmd;%path%"
+
WORKDIR /
EXPOSE 9000
diff --git a/gruntfile.js b/gruntfile.js
index 1d1645fb1..bf03bd194 100644
--- a/gruntfile.js
+++ b/gruntfile.js
@@ -19,6 +19,8 @@ module.exports = function (grunt) {
binaries: {
dockerLinuxVersion: '19.03.13',
dockerWindowsVersion: '19-03-12',
+ dockerLinuxComposeVersion: '1.27.4',
+ dockerWindowsComposeVersion: '1.28.0',
komposeVersion: 'v1.22.0',
kubectlVersion: 'v1.18.0',
},
@@ -37,6 +39,7 @@ module.exports = function (grunt) {
grunt.registerTask('build:server', [
'shell:build_binary:linux:' + arch,
'shell:download_docker_binary:linux:' + arch,
+ 'shell:download_docker_compose_binary:linux:' + arch,
'shell:download_kompose_binary:linux:' + arch,
'shell:download_kubectl_binary:linux:' + arch,
]);
@@ -63,6 +66,7 @@ module.exports = function (grunt) {
'copy:assets',
'shell:build_binary:' + p + ':' + a,
'shell:download_docker_binary:' + p + ':' + a,
+ 'shell:download_docker_compose_binary:' + p + ':' + a,
'shell:download_kompose_binary:' + p + ':' + a,
'shell:download_kubectl_binary:' + p + ':' + a,
'webpack:prod',
@@ -77,6 +81,7 @@ module.exports = function (grunt) {
'copy:assets',
'shell:build_binary_azuredevops:' + p + ':' + a,
'shell:download_docker_binary:' + p + ':' + a,
+ 'shell:download_docker_compose_binary:' + p + ':' + a,
'shell:download_kompose_binary:' + p + ':' + a,
'shell:download_kubectl_binary:' + p + ':' + a,
'webpack:prod',
@@ -138,6 +143,7 @@ gruntfile_cfg.shell = {
download_docker_binary: { command: shell_download_docker_binary },
download_kompose_binary: { command: shell_download_kompose_binary },
download_kubectl_binary: { command: shell_download_kubectl_binary },
+ download_docker_compose_binary: { command: shell_download_docker_compose_binary },
run_container: { command: shell_run_container },
run_localserver: { command: shell_run_localserver, options: { async: true } },
install_yarndeps: { command: shell_install_yarndeps },
@@ -171,7 +177,7 @@ function shell_run_container() {
'docker rm -f portainer',
'docker run -d -p 8000:8000 -p 9000:9000 -v $(pwd)/dist:/app -v ' +
portainer_data +
- ':/data -v /var/run/docker.sock:/var/run/docker.sock:z --name portainer portainer/base /app/portainer',
+ ':/data -v /var/run/docker.sock:/var/run/docker.sock:z -v /tmp:/tmp --name portainer portainer/base /app/portainer',
].join(';');
}
@@ -204,6 +210,38 @@ function shell_download_docker_binary(p, a) {
}
}
+function shell_download_docker_compose_binary(p, a) {
+ console.log('request docker compose for ' + p + ':' + a);
+ var ps = { windows: 'win', darwin: 'mac' };
+ var as = { arm: 'armhf', arm64: 'aarch64' };
+ var ip = ps[p] || p;
+ var ia = as[a] || a;
+ console.log('download docker compose for ' + ip + ':' + ia);
+ var linuxBinaryVersion = '<%= binaries.dockerLinuxComposeVersion %>';
+ var windowsBinaryVersion = '<%= binaries.dockerWindowsComposeVersion %>';
+ console.log('download docker compose versions; Linux: ' + linuxBinaryVersion + ' Windows: ' + windowsBinaryVersion);
+
+ if (ip === 'linux' || ip === 'mac') {
+ return [
+ 'if [ -f dist/docker-compose ]; then',
+ 'echo "Docker Compose binary exists";',
+ 'else',
+ 'build/download_docker_compose_binary.sh ' + ip + ' ' + ia + ' ' + linuxBinaryVersion + ';',
+ 'fi',
+ ].join(' ');
+ } else if (ip === 'win') {
+ return [
+ 'powershell -Command "& {if (Test-Path -Path "dist/docker-compose.exe") {',
+ 'Write-Host "Skipping download, Docker Compose binary exists"',
+ 'return',
+ '} else {',
+ '& ".\\build\\download_docker_compose_binary.ps1" -docker_compose_version ' + windowsBinaryVersion + '',
+ '}}"',
+ ].join(' ');
+ }
+ console.log('docker compose is downloaded');
+}
+
function shell_download_kompose_binary(p, a) {
var binaryVersion = '<%= binaries.komposeVersion %>';
diff --git a/package.json b/package.json
index e8363c377..a458dea5d 100644
--- a/package.json
+++ b/package.json
@@ -21,7 +21,8 @@
"build:server": "grunt clean:server && grunt build:server",
"build:client": "grunt clean:client && grunt build:client",
"clean": "grunt clean:all",
- "start": "grunt clean:all && grunt start",
+ "start": "grunt start",
+ "start:clean": "grunt clean:all && grunt start",
"start:localserver": "grunt start:localserver",
"start:server": "grunt clean:server && grunt start:server",
"start:client": "grunt clean:client && grunt start:client",