Skip to content

Commit 0f998da

Browse files
committed
Update How to use to explain how to build and run the dockers locally
1 parent 1247134 commit 0f998da

File tree

4 files changed

+119
-3
lines changed

4 files changed

+119
-3
lines changed

.github/workflows/publish.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,12 @@ jobs:
3939
run: ./generate_tags.sh
4040
working-directory: base
4141

42-
- name: Base Images > Docker Build Tags
42+
- name: Base Images > Docker Build Tags without pushing
4343
run: ./docker_tags.sh
44-
if: ${{ github.event_name == 'pull_request' }}
44+
if: ${{ github.event_name != 'push' || github.ref != 'refs/heads/master' || steps.changes.outputs.base != 'true' }}
4545
working-directory: base
4646

47-
- name: Base Images > Docker Build & Push
47+
- name: Base Images > Docker Build & Force Push
4848
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' && steps.changes.outputs.base == 'true' }}
4949
run: ./docker_tags.sh -p -f
5050
working-directory: base

HOW-TO-USE.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,3 +111,46 @@ $ nosetests --with-id 7
111111
```
112112
113113
This will also generate a `.nodeids` binary file, when you add new test methods you need to remove this file to re-generate the list of IDs.
114+
115+
## Building and running PrestaShop docker locally
116+
117+
First to make sure you will use the local docker containers and not the ones from Docker hub make sure you remove all existing PrestaShop images (including the base images)
118+
119+
```
120+
# This should be empty to be extra sure
121+
$ docker images
122+
```
123+
124+
Then you'll have to build the base image for the PHP version and server you are willing to use. If you are on MacOS this is crucial that you clean any image from cache and tun this locally,
125+
especially if your architecture is based on linux/arm64 (processor M1, M2, ...).
126+
127+
```shell
128+
docker build base/images/8.3-apache -t prestashop/base:8.3-apache
129+
# You should see an image with Repository: prestashop Tag: 8.3-apache
130+
docker images
131+
```
132+
133+
Then you can build the image of the PrestaShop version you want to use:
134+
135+
```
136+
# Now build the PrestaShop version you want based on this local base image
137+
$ docker build images/9.0.x/8.3-apache -t prestashop/prestashop:9.0.x-8.3-apache
138+
```
139+
140+
Finally, you can launch your PrestaShop container using docker compose
141+
142+
```
143+
$ PS_VERSION=9.0.x PHP_VERSION=8.3 docker compose -f images/docker-compose.yml up
144+
```
145+
146+
Or you can use this script that performs these actions based on the arguments
147+
148+
```
149+
# Default values are nightly 8.3 apache
150+
./build-local-docker.sh 9.0.x 8.1 fpm
151+
```
152+
153+
Now you should be able to access a shop at this address: `http://localhost:8001/`
154+
The BO is accessible at `http://localhost:8001/admin-dev` with the following login:
155+
156+
Password: `Correct Horse Battery Staple`

build-local-docker.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/bin/sh
2+
3+
PS_VERSION=nigthly
4+
PHP_VERSION=8.3
5+
SERVER=apache
6+
7+
if [ $# -gt 0 ]; then
8+
PS_VERSION=$1
9+
fi
10+
if [ $# -gt 1 ]; then
11+
PHP_VERSION=$2
12+
fi
13+
if [ $# -gt 2 ]; then
14+
SERVER=$3
15+
fi
16+
17+
echo Building PrestaShop $PS_VERSION with PHP $PHP_VERSION and Server $SERVER
18+
19+
echo Building base image for PHP $PHP_VERSION with $SERVER
20+
docker build base/images/$PHP_VERSION-$SERVER -t prestashop/base:$PHP_VERSION-$SERVER
21+
22+
echo Building PrestaShop image for version $PS_VERSION
23+
docker build images/$PS_VERSION/$PHP_VERSION-$SERVER -t prestashop/prestashop:$PS_VERSION-$PHP_VERSION-$SERVER
24+
25+
echo Launching docker container with docker compose
26+
PS_VERSION=$PS_VERSION PHP_VERSION=$PHP_VERSION SERVER=$SERVER docker compose -f images/docker-compose.yml up

images/docker-compose.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
version: '2.1'
2+
3+
services:
4+
mysql:
5+
image: mysql:8
6+
ports:
7+
- "3306:3306"
8+
environment:
9+
MYSQL_ROOT_PASSWORD: ${DB_PASSWD:-prestashop}
10+
MYSQL_DATABASE: ${DB_NAME:-prestashop}
11+
restart: unless-stopped
12+
networks:
13+
- prestashop-network
14+
15+
prestashop:
16+
image: prestashop/prestashop:${PS_VERSION}-${PHP_VERSION}-${SERVER:-apache}
17+
container_name: prestashop
18+
depends_on:
19+
- mysql
20+
environment:
21+
DISABLE_MAKE: ${DISABLE_MAKE:-0}
22+
PS_INSTALL_AUTO: ${PS_INSTALL_AUTO:-1}
23+
DB_PASSWD: ${DB_PASSWD:-prestashop}
24+
DB_NAME: ${DB_NAME:-prestashop}
25+
DB_SERVER: ${DB_SERVER:-mysql}
26+
DB_PREFIX: ${DB_PREFIX:-ps_}
27+
PS_DOMAIN: ${PS_DOMAIN:-localhost:8001}
28+
PS_FOLDER_INSTALL: ${PS_FOLDER_INSTALL:-install-dev}
29+
PS_FOLDER_ADMIN: ${PS_FOLDER_ADMIN:-admin-dev}
30+
PS_COUNTRY: ${PS_COUNTRY:-fr}
31+
PS_LANGUAGE: ${PS_LANGUAGE:-en}
32+
PS_DEV_MODE: ${PS_DEV_MODE:-1}
33+
PS_ENABLE_SSL: ${PS_ENABLE_SSL:-0}
34+
PS_ERASE_DB: ${PS_ERASE_DB:-0}
35+
PS_USE_DOCKER_MAILDEV: ${PS_USE_DOCKER_MAILDEV:-1}
36+
ADMIN_MAIL: ${ADMIN_MAIL:[email protected]}
37+
ADMIN_PASSWD: ${ADMIN_PASSWD:-Correct Horse Battery Staple}
38+
NODE_VERSION: ${NODE_VERSION:-v20.17.0}
39+
ports:
40+
- "8001:80"
41+
- "8002:443"
42+
networks:
43+
- prestashop-network
44+
45+
networks:
46+
prestashop-network:
47+
name: prestashop-network

0 commit comments

Comments
 (0)