-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c4380ef
commit 03d40cf
Showing
3 changed files
with
64 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: push | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v*' | ||
|
||
jobs: | ||
push: | ||
name: "Build and push ${{ github.ref_name }}" | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build and push ${{ matrix.image }} | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: "{{defaultContext}}:./" | ||
push: true | ||
build-args: VERSION=${{ github.ref_name }} | ||
tags: ghcr.io/deployphp/deployer:${{ github.ref_name }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
## Compile the PHAR | ||
FROM php:8.1-cli-alpine as build | ||
|
||
ENV COMPOSER_ALLOW_SUPERUSER=1 | ||
|
||
# Copy Composer from official image | ||
COPY --from=composer/composer:2-bin /composer /usr/bin/composer | ||
|
||
# Allow to generate .phar files | ||
RUN echo -e "[PHP]\nphar.readonly = Off" >> /usr/local/etc/php/php.ini | ||
|
||
WORKDIR /app/ | ||
|
||
# Copy sources files | ||
COPY ./ /app/ | ||
|
||
ARG VERSION | ||
|
||
# Install dependencies and build PHAR | ||
RUN composer install --no-dev --quiet && /app/bin/build -v$VERSION | ||
|
||
|
||
# Copy the PHAR file in the final image | ||
FROM php:8.1-cli-alpine | ||
|
||
COPY --from=build /app/deployer.phar /usr/local/bin/deployer | ||
|
||
## Make deployer executable and check that it can be executed | ||
RUN chmod +x /usr/local/bin/deployer && deployer --version | ||
|
||
# Call deployer automatically | ||
ENTRYPOINT ["/usr/local/bin/deployer"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters