Skip to content

Commit

Permalink
chore(docker): Handle classic image generation and generate for beta 1
Browse files Browse the repository at this point in the history
  • Loading branch information
tleon committed Feb 10, 2025
1 parent 52b92f6 commit e39c1a6
Show file tree
Hide file tree
Showing 11 changed files with 126 additions and 5 deletions.
13 changes: 13 additions & 0 deletions images/9.0.0-beta.1-classic/8.1-apache/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM prestashop/base:8.1-apache
LABEL maintainer="PrestaShop Core Team <[email protected]>"

ENV PS_VERSION 9.0.0-beta.1-classic

# Get PrestaShop
ADD https://github.com/PrestaShopCorp/PrestaShop-classic/releases/download/9.0.0-beta.1-classic/prestashop_9.0.0-beta.1-classic.zip /tmp/prestashop.zip

# Extract
RUN mkdir -p /tmp/data-ps \
&& unzip -q /tmp/prestashop.zip -d /tmp/data-ps/ \
&& bash /tmp/ps-extractor.sh /tmp/data-ps \
&& rm /tmp/prestashop.zip
13 changes: 13 additions & 0 deletions images/9.0.0-beta.1-classic/8.1-fpm/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM prestashop/base:8.1-fpm
LABEL maintainer="PrestaShop Core Team <[email protected]>"

ENV PS_VERSION 9.0.0-beta.1-classic

# Get PrestaShop
ADD https://github.com/PrestaShopCorp/PrestaShop-classic/releases/download/9.0.0-beta.1-classic/prestashop_9.0.0-beta.1-classic.zip /tmp/prestashop.zip

# Extract
RUN mkdir -p /tmp/data-ps \
&& unzip -q /tmp/prestashop.zip -d /tmp/data-ps/ \
&& bash /tmp/ps-extractor.sh /tmp/data-ps \
&& rm /tmp/prestashop.zip
13 changes: 13 additions & 0 deletions images/9.0.0-beta.1-classic/8.2-apache/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM prestashop/base:8.2-apache
LABEL maintainer="PrestaShop Core Team <[email protected]>"

ENV PS_VERSION 9.0.0-beta.1-classic

# Get PrestaShop
ADD https://github.com/PrestaShopCorp/PrestaShop-classic/releases/download/9.0.0-beta.1-classic/prestashop_9.0.0-beta.1-classic.zip /tmp/prestashop.zip

# Extract
RUN mkdir -p /tmp/data-ps \
&& unzip -q /tmp/prestashop.zip -d /tmp/data-ps/ \
&& bash /tmp/ps-extractor.sh /tmp/data-ps \
&& rm /tmp/prestashop.zip
13 changes: 13 additions & 0 deletions images/9.0.0-beta.1-classic/8.2-fpm/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM prestashop/base:8.2-fpm
LABEL maintainer="PrestaShop Core Team <[email protected]>"

ENV PS_VERSION 9.0.0-beta.1-classic

# Get PrestaShop
ADD https://github.com/PrestaShopCorp/PrestaShop-classic/releases/download/9.0.0-beta.1-classic/prestashop_9.0.0-beta.1-classic.zip /tmp/prestashop.zip

# Extract
RUN mkdir -p /tmp/data-ps \
&& unzip -q /tmp/prestashop.zip -d /tmp/data-ps/ \
&& bash /tmp/ps-extractor.sh /tmp/data-ps \
&& rm /tmp/prestashop.zip
13 changes: 13 additions & 0 deletions images/9.0.0-beta.1-classic/8.3-apache/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM prestashop/base:8.3-apache
LABEL maintainer="PrestaShop Core Team <[email protected]>"

ENV PS_VERSION 9.0.0-beta.1-classic

# Get PrestaShop
ADD https://github.com/PrestaShopCorp/PrestaShop-classic/releases/download/9.0.0-beta.1-classic/prestashop_9.0.0-beta.1-classic.zip /tmp/prestashop.zip

# Extract
RUN mkdir -p /tmp/data-ps \
&& unzip -q /tmp/prestashop.zip -d /tmp/data-ps/ \
&& bash /tmp/ps-extractor.sh /tmp/data-ps \
&& rm /tmp/prestashop.zip
13 changes: 13 additions & 0 deletions images/9.0.0-beta.1-classic/8.3-fpm/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM prestashop/base:8.3-fpm
LABEL maintainer="PrestaShop Core Team <[email protected]>"

ENV PS_VERSION 9.0.0-beta.1-classic

# Get PrestaShop
ADD https://github.com/PrestaShopCorp/PrestaShop-classic/releases/download/9.0.0-beta.1-classic/prestashop_9.0.0-beta.1-classic.zip /tmp/prestashop.zip

# Extract
RUN mkdir -p /tmp/data-ps \
&& unzip -q /tmp/prestashop.zip -d /tmp/data-ps/ \
&& bash /tmp/ps-extractor.sh /tmp/data-ps \
&& rm /tmp/prestashop.zip
13 changes: 13 additions & 0 deletions images/9.0.0-beta.1-classic/8.4-apache/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM prestashop/base:8.4-apache
LABEL maintainer="PrestaShop Core Team <[email protected]>"

ENV PS_VERSION 9.0.0-beta.1-classic

# Get PrestaShop
ADD https://github.com/PrestaShopCorp/PrestaShop-classic/releases/download/9.0.0-beta.1-classic/prestashop_9.0.0-beta.1-classic.zip /tmp/prestashop.zip

# Extract
RUN mkdir -p /tmp/data-ps \
&& unzip -q /tmp/prestashop.zip -d /tmp/data-ps/ \
&& bash /tmp/ps-extractor.sh /tmp/data-ps \
&& rm /tmp/prestashop.zip
13 changes: 13 additions & 0 deletions images/9.0.0-beta.1-classic/8.4-fpm/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM prestashop/base:8.4-fpm
LABEL maintainer="PrestaShop Core Team <[email protected]>"

ENV PS_VERSION 9.0.0-beta.1-classic

# Get PrestaShop
ADD https://github.com/PrestaShopCorp/PrestaShop-classic/releases/download/9.0.0-beta.1-classic/prestashop_9.0.0-beta.1-classic.zip /tmp/prestashop.zip

# Extract
RUN mkdir -p /tmp/data-ps \
&& unzip -q /tmp/prestashop.zip -d /tmp/data-ps/ \
&& bash /tmp/ps-extractor.sh /tmp/data-ps \
&& rm /tmp/prestashop.zip
6 changes: 5 additions & 1 deletion prestashop_docker/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def __init__(self, directory_path, template, nightly_template, branch_template):
self.download_url = 'https://www.prestashop.com/download/old/' \
'prestashop_{}.zip'
self.download_url_github = 'https://github.com/PrestaShop/PrestaShop/releases/download/{}/prestashop_{}.zip'
self.download_url_github_classic = 'https://github.com/PrestaShopCorp/PrestaShop-classic/releases/download/{}/prestashop_{}.zip'
self.directory_path = directory_path
self.template = Template(template)
self.nightly_template = Template(nightly_template)
Expand Down Expand Up @@ -92,7 +93,10 @@ def generate_image(self, ps_version, container_version):
use_github_url = False

if use_github_url:
ps_url = self.download_url_github.format(ps_version, ps_version)
if parsed_version['flavor_versions'] == 'classic':
ps_url = self.download_url_github_classic.format(ps_version, ps_version)
else:
ps_url = self.download_url_github.format(ps_version, ps_version)
else:
ps_url = self.download_url.format(ps_version)
f.write(
Expand Down
15 changes: 11 additions & 4 deletions prestashop_docker/version_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,21 @@ def get_version_from_string(self, version):
@param version: The version you want
@type version: str
@return: A tuple containing ('PS_VERSION', 'BRANCH_VERSION', (PHP_VERSIONS), 'CONTAINER_TYPE')
or ('PS_VERSION', 'BRANCH_VERSION', 'PHP_VERSION', 'CONTAINER_TYPE')
@return: A tuple containing ('PS_VERSION', 'BRANCH_VERSION', (PHP_VERSIONS), 'CONTAINER_TYPE', 'FLAVOR_VERSION')
or ('PS_VERSION', 'BRANCH_VERSION', 'PHP_VERSION', 'CONTAINER_TYPE', 'FLAVOR_VERSION')
@rtype: tuple
'''
matches = self.parse_version_from_string(version)
if not matches:
return None

ps_version = matches.group('version')

flavor_versions = None
if matches.group('flavor'):
flavor_versions = matches.group('flavor')
ps_version = ps_version + '-' + flavor_versions

if matches.group('php'):
php_versions = (matches.group('php'),)
else:
Expand Down Expand Up @@ -140,7 +146,8 @@ def get_version_from_string(self, version):
'ps_version': ps_version,
'branch_version': branch_version,
'php_versions': php_versions,
'container_version': container_version
'container_version': container_version,
'flavor_versions': flavor_versions
}

def get_last_patch_from_version(self, version):
Expand Down Expand Up @@ -201,7 +208,7 @@ def parse_version_from_string(self, version):
@return: Return None if no position in the string matches the pattern otherwise a Match object.
@rtpe: None|Match
'''
regex = r"^(?P<version>(?:[0-9]+\.){0,3}(?:[0-9]+|nightly|x)(?:-(?:alpha|beta|rc)(?:\.\d+)?(?:\+\d+)?)?)(?:-(?P<php>\d+\.\d+))?(?:-(?P<container>fpm|apache))?$"
regex = r"^(?P<version>(?:[0-9]+\.){0,3}(?:[0-9]+|nightly|x)(?:-(?:alpha|beta|rc)(?:\.\d+)?(?:\+\d+)?)?)(?:-(?P<flavor>classic))?(?:-(?P<php>\d+\.\d+))?(?:-(?P<container>fpm|apache))?$"
return re.search(regex, version)

def get_aliases(self):
Expand Down
6 changes: 6 additions & 0 deletions versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,12 @@
'8.3',
'8.4',
),
'9.0.0-beta.1-classic': (
'8.1',
'8.2',
'8.3',
'8.4',
),
'nightly': (
'8.1',
'8.2',
Expand Down

0 comments on commit e39c1a6

Please sign in to comment.