-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: #30 pack server into a docker image
Release-As: 0.0.1
- Loading branch information
1 parent
6093084
commit 7b76ad1
Showing
3 changed files
with
88 additions
and
0 deletions.
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,2 @@ | ||
node_modules/ | ||
vendor/ |
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,60 @@ | ||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
permissions: | ||
contents: write | ||
packages: write | ||
pull-requests: write | ||
id-token: write | ||
|
||
name: release-please | ||
|
||
jobs: | ||
release-please: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
release_created: ${{ steps.release.outputs.release_created }} | ||
tag_name: ${{ steps.release.outputs.tag_name }} | ||
steps: | ||
- uses: googleapis/release-please-action@v4 | ||
id: release | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
release-type: php | ||
- run: echo "release_created=${{ steps.release.outputs.release_created }}" >> "$GITHUB_OUTPUT" | ||
- run: echo "tag_name=${{ steps.release.outputs.tag_name }}" >> "$GITHUB_OUTPUT" | ||
|
||
build-and-publish: | ||
runs-on: ubuntu-latest | ||
needs: release-please | ||
if: ${{ needs.release-please.outputs.release_created }} | ||
steps: | ||
- name: Login to Docker Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Build and push | ||
uses: docker/build-push-action@v5 | ||
with: | ||
push: true | ||
tags: ghcr.io/ptah-sh/ptah-server:latest,ghcr.io/ptah-sh/ptah-server:${{ needs.release-please.outputs.tag_name }} | ||
# TODO: should we create a github deployment? | ||
deploy: | ||
runs-on: ubuntu-latest | ||
needs: | ||
- release-please | ||
- build-and-publish | ||
if: ${{ needs.release-please.outputs.release_created }} | ||
steps: | ||
- name: Deploy | ||
run: | | ||
curl --fail-with-body -X POST \ | ||
-H 'Content-Type: application/json' \ | ||
-H 'Accept: application/json' \ | ||
-H 'X-Ptah-Token: ${{ secrets.PTAH_TOKEN }}' \ | ||
-d '{"processes":[{"name":"svc","dockerImage":"ghcr.io/ptah-sh/ptah-server:${{ needs.release-please.outputs.tag_name }}"}]}' \ | ||
https://app.ptah.sh/api/v0/services/2/deploy |
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,26 @@ | ||
FROM bitnami/php-fpm:latest | ||
|
||
RUN install_packages nodejs npm \ | ||
&& apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives | ||
|
||
WORKDIR /app | ||
|
||
ENV COMPOSER_ALLOW_SUPERUSER=1 | ||
|
||
COPY package.json . | ||
COPY package-lock.json . | ||
|
||
RUN npm i --frozen-lockfile | ||
|
||
COPY composer.json . | ||
COPY composer.lock . | ||
|
||
RUN composer install --no-scripts | ||
|
||
COPY . . | ||
|
||
RUN composer install | ||
|
||
RUN npm run build \ | ||
&& apt-get -y remove npm \ | ||
&& apt-get -y autoremove \ |