Skip to content

Commit 3cba55c

Browse files
committed
Add template to generate docker based on a branch
1 parent c95a5bc commit 3cba55c

File tree

4 files changed

+22
-2
lines changed

4 files changed

+22
-2
lines changed

Dockerfile-branch.model

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
FROM prestashop/base:$container_version
2+
LABEL maintainer="PrestaShop Core Team <[email protected]>"
3+
4+
RUN apt update
5+
RUN apt -y install git
6+
7+
RUN git clone -b $ps_version https://github.com/PrestaShop/PrestaShop.git /tmp/data-ps
8+
9+
CMD ["/tmp/docker_run.sh"]

prestashop_docker.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ def main():
9090
generator = Generator(
9191
path.join(path.dirname(path.realpath(__file__)), 'images'),
9292
open('./Dockerfile.model').read(),
93-
open('./Dockerfile-nightly.model').read()
93+
open('./Dockerfile-nightly.model').read(),
94+
open('./Dockerfile-branch.model').read()
9495
)
9596
generator.generate_all(VERSIONS)
9697
elif args.subcommand == 'tag':

prestashop_docker/generator.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
class Generator:
99
NIGHTLY = 'nightly'
1010

11-
def __init__(self, directory_path, template, nightly_template):
11+
def __init__(self, directory_path, template, nightly_template, branch_template):
1212
"""Constructor
1313
1414
@param directory_path: Directory path
@@ -17,13 +17,16 @@ def __init__(self, directory_path, template, nightly_template):
1717
@type template: str
1818
@param nightly_template: Nightly template
1919
@type nightly_template: str
20+
@param branch_template: Branch template
21+
@type branch_template: str
2022
"""
2123
self.download_url = 'https://www.prestashop.com/download/old/' \
2224
'prestashop_{}.zip'
2325
self.download_url_github = 'https://github.com/PrestaShop/PrestaShop/releases/download/{}/prestashop_{}.zip'
2426
self.directory_path = directory_path
2527
self.template = Template(template)
2628
self.nightly_template = Template(nightly_template)
29+
self.branch_template = Template(branch_template)
2730

2831
def create_directory(self, directory_path):
2932
"""Try to create a directory if it's possible
@@ -57,6 +60,8 @@ def generate_image(self, ps_version, container_version):
5760
file_path = path.join(directory_path, 'Dockerfile')
5861
template = self.nightly_template if (
5962
ps_version == self.NIGHTLY
63+
) else self.branch_template if (
64+
ps_version.endswith('.x')
6065
) else self.template
6166

6267
with open(file_path, 'w+') as f:

versions.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,11 @@
261261
'8.0',
262262
'8.1',
263263
),
264+
'9.0.x': (
265+
'8.1',
266+
'8.2',
267+
'8.3',
268+
),
264269
'nightly': (
265270
'8.1',
266271
'8.2',

0 commit comments

Comments
 (0)