Skip to content

Commit 47a350f

Browse files
committed
Docker: adding Gulp and Python components.
1 parent 78bfa69 commit 47a350f

File tree

3 files changed

+61
-0
lines changed

3 files changed

+61
-0
lines changed

src/PostSharp.Engineering.BuildTools/Docker/ContainerComponentKind.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,7 @@ public enum ContainerComponentKind
1515
VsBuildTools,
1616
Chocolatey,
1717
NodeJs,
18+
Python,
19+
Gulp,
1820
Epilogue
1921
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// Copyright (c) SharpCrafters s.r.o. See the LICENSE.md file in the root directory of this repository root for details.
2+
3+
using System;
4+
using System.Collections.Generic;
5+
using System.IO;
6+
using System.Linq;
7+
8+
namespace PostSharp.Engineering.BuildTools.Docker;
9+
10+
public class GulpComponent : ContainerComponent
11+
{
12+
public override string Name => "Install Gulp";
13+
14+
public override ContainerComponentKind Kind => ContainerComponentKind.Gulp;
15+
16+
public override void WriteDockerfile( TextWriter writer )
17+
{
18+
writer.WriteLine(
19+
"""
20+
RUN npm install --global gulp-cli gulp
21+
""" );
22+
}
23+
24+
public override void AddRequirements( IReadOnlyList<ContainerComponent> components, Action<ContainerComponent> add )
25+
{
26+
base.AddRequirements( components, add );
27+
28+
if ( !components.OfType<NodeJsComponent>().Any() )
29+
{
30+
throw new InvalidOperationException( $"{nameof(NodeJsComponent)} is required." );
31+
}
32+
}
33+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Copyright (c) SharpCrafters s.r.o. See the LICENSE.md file in the root directory of this repository root for details.
2+
3+
using JetBrains.Annotations;
4+
using System.IO;
5+
6+
namespace PostSharp.Engineering.BuildTools.Docker;
7+
8+
[PublicAPI]
9+
public class PythonComponent : ContainerComponent
10+
{
11+
private readonly string _version;
12+
13+
public PythonComponent( string version )
14+
{
15+
this._version = version;
16+
}
17+
18+
public override string Name => $"Install Python {this._version}";
19+
20+
public override ContainerComponentKind Kind => ContainerComponentKind.Python;
21+
22+
public override void WriteDockerfile( TextWriter writer )
23+
{
24+
writer.WriteLine( "RUN choco install -y python311" );
25+
}
26+
}

0 commit comments

Comments
 (0)