Skip to content

Commit c0506d0

Browse files
committed
feat: add PHP application template
1 parent fcf1ead commit c0506d0

7 files changed

Lines changed: 752 additions & 0 deletions

File tree

‎.github/workflows/build.yaml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ jobs:
2121
- go
2222
- javascript
2323
- lua
24+
- php
2425
- python
2526
- ruby
2627
- rust

‎rollups/php/.dockerignore‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.cartesi
2+
vendor

‎rollups/php/.gitignore‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.cartesi
2+
vendor

‎rollups/php/Dockerfile‎

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# syntax=docker.io/docker/dockerfile:1
2+
3+
# This enforces that the packages downloaded from the repositories are the same
4+
# for the defined date, no matter when the image is built.
5+
ARG UBUNTU_TAG=noble-20250404
6+
ARG APT_UPDATE_SNAPSHOT=20250408T030400Z
7+
8+
################################################################################
9+
# riscv64 base stage
10+
FROM --platform=linux/riscv64 ubuntu:${UBUNTU_TAG} AS base
11+
12+
ARG APT_UPDATE_SNAPSHOT
13+
ARG DEBIAN_FRONTEND=noninteractive
14+
RUN <<EOF
15+
set -eu
16+
apt-get update
17+
apt-get install -y --no-install-recommends ca-certificates curl
18+
apt-get update --snapshot=${APT_UPDATE_SNAPSHOT}
19+
EOF
20+
21+
################################################################################
22+
# riscv64 builder stage
23+
FROM base AS builder
24+
25+
ARG DEBIAN_FRONTEND=noninteractive
26+
RUN <<EOF
27+
set -e
28+
apt-get install -y --no-install-recommends \
29+
php8.3-cli \
30+
php8.3-curl \
31+
composer \
32+
git \
33+
unzip
34+
rm -rf /var/lib/apt/lists/* /var/log/* /var/cache/*
35+
EOF
36+
37+
WORKDIR /usr/src/app
38+
39+
COPY composer.json composer.lock ./
40+
RUN composer install
41+
42+
################################################################################
43+
# runtime stage: produces final image that will be executed
44+
FROM base
45+
46+
ARG MACHINE_GUEST_TOOLS_VERSION=0.17.0-test6
47+
ARG DEBIAN_FRONTEND=noninteractive
48+
RUN <<EOF
49+
set -e
50+
apt-get update
51+
apt-get install -y --no-install-recommends \
52+
busybox-static \
53+
php8.3-cli \
54+
php8.3-curl
55+
56+
cd /tmp
57+
busybox wget https://github.com/cartesi/machine-guest-tools/releases/download/v${MACHINE_GUEST_TOOLS_VERSION}/machine-guest-tools_riscv64.deb
58+
echo "850ddd259832497d122f05da54f91217852d57dd47c24a02efa66a44843b0f9c8c29cd81d3fa6d0f804d4a0b89466af00e619348dde94f23150cfd0f8bc930c8 /tmp/machine-guest-tools_riscv64.deb" \
59+
| sha512sum -c
60+
apt-get install -y --no-install-recommends \
61+
/tmp/machine-guest-tools_riscv64.deb
62+
rm /tmp/machine-guest-tools_riscv64.deb
63+
64+
rm -rf /var/lib/apt/lists/* /var/log/* /var/cache/*
65+
EOF
66+
67+
ENV PATH="/opt/cartesi/bin:${PATH}"
68+
69+
COPY --from=builder /usr/src/app/vendor /usr/src/app/vendor
70+
71+
WORKDIR /usr/src/app
72+
COPY index.php .
73+
74+
ENTRYPOINT ["rollup-init"]
75+
CMD ["php", "index.php"]

‎rollups/php/composer.json‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"require": {
3+
"guzzlehttp/guzzle": "^7.0"
4+
}
5+
}

0 commit comments

Comments
 (0)