-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
introduced Debian-version and Matrix-Builds
- Loading branch information
Showing
8 changed files
with
100 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,76 @@ | ||
[CmdletBinding()] | ||
param( | ||
[Parameter(Mandatory=$true, HelpMessage="Specify the version of the image you want to create. (directories in ./image) [default: 'base']")] | ||
[String]$image, | ||
|
||
[Parameter(Mandatory=$true, HelpMessage="Enter the specified node-version (e.g. 6.10.2) from https://nodejs.org/en/download/releases/.")] | ||
[String]$node_version, | ||
|
||
[switch]$silent, | ||
[Parameter(HelpMessage="Specify the versions of the image you want to create. (suffixes in ./images; base images are generated by default)")] | ||
[String]$customized_images = "", | ||
|
||
[Switch]$silent, | ||
|
||
[switch]$publish | ||
[Switch]$publish | ||
) | ||
|
||
$tag = $image + "-" + $node_version | ||
$imagename = "softaware/webdev" + ":" + $tag | ||
$imagepath = "./image/" + $image + "/" | ||
$dockerfile = $imagepath + "Dockerfile" | ||
$generatedfile = $imagepath + "Dockerfile.gen" | ||
# ===== CONSTANTS ===== | ||
$repositoryname = "softaware/webdev" | ||
$imagepath = "./images/" | ||
$dockerfilerootpath = "$($imagepath)Dockerfile" | ||
|
||
function Generate-Image { | ||
param( | ||
[String]$node_version, | ||
[String]$image_type, | ||
[String]$application_type, | ||
[Boolean]$silent, | ||
[Boolean]$publish | ||
) | ||
|
||
$template = Get-Content $dockerfile -Raw | ||
$generated = $template.Replace("{{ node_version }}", $node_version) | ||
$generated | Out-File -Encoding UTF8 $generatedfile | ||
$generatedfile = $imagepath + "Dockerfile.gen" | ||
|
||
$command = {docker image build (&{If($silent) {"--quiet"}}) --force-rm -f $generatedfile -t $imagename $imagepath} | ||
if (!$silent) {& $command} else {& $command | Out-Null} | ||
$dockerfile = $dockerfilerootpath + "." + $image_type + $(If($application_type) { ".$($application_type)" }) | ||
$tag = $image_type + "-" + $node_version + $(If($application_type) { "-$($application_type)" }) | ||
$imagename = $repositoryname + ":" + $tag | ||
|
||
$template = Get-Content $dockerfile -Raw | ||
$generated = $template.Replace("{{ node_version }}", $node_version) | ||
$generated | Out-File -Encoding UTF8 $generatedfile | ||
|
||
$command = {docker image build (&{If($silent) {"--quiet"}}) --force-rm -f $generatedfile -t $imagename $imagepath} | ||
if (!$silent) {& $command} else {& $command | Out-Null} | ||
Remove-Item $generatedfile | ||
|
||
"$($imagename) created successfully" | ||
"$($imagename) created successfully" | ||
|
||
if ($publish) { | ||
if ($publish) { | ||
Publish-Image $imagename | ||
} | ||
} | ||
|
||
function Publish-Image { | ||
param( | ||
[String]$imagename | ||
) | ||
$command = {docker push $imagename} | ||
if (!$silent) {& $command} else {& $command | Out-Null} | ||
|
||
"$($imagename) published successfully" | ||
} | ||
|
||
function Generate-Images { | ||
param( | ||
[String]$node_version, | ||
[String[]]$image_types, | ||
[String]$application_type, | ||
[Boolean]$silent, | ||
[Boolean]$publish | ||
) | ||
foreach ($image_type in $image_types) { | ||
Generate-Image $node_version $image_type $image $silent $publish | ||
} | ||
} | ||
|
||
$images = @("") + ($customized_images.Split(",") | % { $_.Trim() }) | ||
|
||
Remove-Item $generatedfile | ||
foreach ($image in $images) { | ||
Generate-Images $node_version @("alpine","debian") $image $silent.IsPresent $publish.IsPresent | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# choose version according to Angular-CLI requirements: https://github.com/angular/angular-cli/blob/master/package.json#L32 | ||
FROM softaware/webdev:node-{{ node_version }} | ||
FROM softaware/webdev:alpine-{{ node_version }} | ||
|
||
# expose Angular CLI port | ||
EXPOSE 4200 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# specify the wanted node/npm version-tag as listed in https://hub.docker.com/r/library/node/tags/ | ||
FROM node:{{ node_version }} | ||
LABEL maintainer "bernhard.mayr@softaware.at" | ||
|
||
# set path in a way, that local npm-modules (e.g. ng-cli) can be called like executables | ||
ENV PATH="./node_modules/.bin:${PATH}" | ||
|
||
# set the working-directory | ||
WORKDIR "/usr/src/app" | ||
|
||
# prepare start-script | ||
COPY ./files/docker-entrypoint.sh /usr/local/bin/ | ||
RUN chmod a+rx /usr/local/bin/docker-entrypoint.sh | ||
|
||
# prepare shell | ||
COPY ./files/.bashrc /root/ | ||
|
||
# executing the start-script and dropping into a new bash session | ||
ENTRYPOINT ["docker-entrypoint.sh"] | ||
CMD ["bash"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# choose version according to Angular-CLI requirements: https://github.com/angular/angular-cli/blob/master/package.json#L32 | ||
FROM softaware/webdev:debian-{{ node_version }} | ||
|
||
# expose Angular CLI port | ||
EXPOSE 4200 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/sh | ||
|
||
if [ -f package.json ]; then | ||
if [ -d node_modules ]; then | ||
printf "Checking npm packages...\n" | ||
else | ||
printf "Installing npm packages...\n" | ||
fi | ||
npm install --loglevel warn | ||
fi | ||
|
||
exec "$@" |