Skip to content

Commit 9f9aa03

Browse files
committed
fix: make phar in docker
1 parent 39d0ac2 commit 9f9aa03

File tree

3 files changed

+23
-14
lines changed

3 files changed

+23
-14
lines changed

.github/workflows/docker.yml

+15-11
Original file line numberDiff line numberDiff line change
@@ -28,33 +28,37 @@ jobs:
2828
username: ${{ github.actor }}
2929
password: ${{ secrets.GITHUB_TOKEN }}
3030

31-
- name: Extract metadata (tags, labels) for Docker
31+
- name: Extract metadata (tags, labels) for Drafter
3232
id: meta-drafter
3333
uses: docker/metadata-action@master
3434
with:
3535
images: ${{ env.REGISTRY }}/${{ github.repository }}/drafter
3636

37-
- name: Extract metadata (tags, labels) for Docker
38-
id: meta
39-
uses: docker/metadata-action@master
40-
with:
41-
images: ${{ env.REGISTRY }}/${{ github.repository }}
42-
43-
- name: Build and push Docker image
37+
- name: Build and push drafter Docker image
4438
uses: docker/build-push-action@master
4539
with:
4640
context: .
4741
push: true
4842
tags: ${{ steps.meta-drafter.outputs.tags }}
4943
labels: ${{ steps.meta-drafter.outputs.labels }}
5044
target: drafter-build
45+
no-cache-filters: drafter-build
5146
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ github.repository }}/drafter:latest
5247

53-
- name: Build and push Docker image
48+
- name: Extract metadata (tags, labels) for PHPDraft
49+
id: meta
50+
uses: docker/metadata-action@master
51+
with:
52+
images: ${{ env.REGISTRY }}/${{ github.repository }}
53+
54+
- name: Build and push PHPDraft Docker image
5455
uses: docker/build-push-action@master
5556
with:
56-
context: .
5757
push: true
5858
tags: ${{ steps.meta.outputs.tags }}
5959
labels: ${{ steps.meta.outputs.labels }}
60-
target: phpdraft
60+
target: phpdraft
61+
no-cache-filters: phpdraft
62+
build-args: |
63+
BUILDKIT_CONTEXT_KEEP_GIT_DIR=true
64+
PHPDRAFT_RELEASE_ID=2.0.0

Dockerfile

+7-2
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,18 @@ RUN composer install --ignore-platform-req=ext-uopz
2424

2525
FROM php:8.3-cli-bullseye AS phpdraft-build
2626

27+
ARG PHPDRAFT_RELEASE_ID=1.0.0
2728

29+
RUN echo $PHPDRAFT_RELEASE_ID
2830

2931
COPY --from=composer /usr/src/phpdraft /usr/src/phpdraft
3032
WORKDIR /usr/src/phpdraft
3133

32-
RUN ./vendor/bin/phing phar-nightly
33-
COPY /usr/src/phpdraft/build/out/phpdraft-nightly.phar /usr/local/bin/phpdraft
34+
RUN php ./phpdraft --version
35+
36+
RUN php -d phar.readonly=0 ./vendor/bin/phing phar-nightly
37+
38+
COPY /usr/src/phpdraft/build/out/phpdraft-*.phar /usr/local/bin/phpdraft
3439
RUN chmod +x /usr/local/bin/phpdraft
3540

3641
FROM php:8.3-cli-bullseye AS phpdraft

src/PHPDraft/Out/Version.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public static function version(): void
3535
*/
3636
public static function release_id(): string
3737
{
38-
return (VERSION === '0') ? @exec('git describe --tags 2>&1') : VERSION;
38+
return $_ENV['PHPDRAFT_RELEASE_ID'] ?? VERSION !== '0' ? VERSION : @exec('git describe --tags 2>&1');
3939
}
4040

4141
/**

0 commit comments

Comments
 (0)