Skip to content

Commit eab0dfa

Browse files
committed
chore: #30 pack server into a docker image
1 parent 6093084 commit eab0dfa

File tree

3 files changed

+88
-0
lines changed

3 files changed

+88
-0
lines changed

Diff for: .dockerignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules/
2+
vendor/

Diff for: .github/workflows/release-please.yml

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
on:
2+
push:
3+
branches:
4+
- main
5+
6+
permissions:
7+
contents: write
8+
packages: write
9+
pull-requests: write
10+
id-token: write
11+
12+
name: release-please
13+
14+
jobs:
15+
release-please:
16+
runs-on: ubuntu-latest
17+
outputs:
18+
release_created: ${{ steps.release.outputs.release_created }}
19+
tag_name: ${{ steps.release.outputs.tag_name }}
20+
steps:
21+
- uses: googleapis/release-please-action@v4
22+
id: release
23+
with:
24+
token: ${{ secrets.GITHUB_TOKEN }}
25+
release-type: php
26+
- run: echo "release_created=${{ steps.release.outputs.release_created }}" >> "$GITHUB_OUTPUT"
27+
- run: echo "tag_name=${{ steps.release.outputs.tag_name }}" >> "$GITHUB_OUTPUT"
28+
29+
build-and-publish:
30+
runs-on: ubuntu-latest
31+
needs: release-please
32+
if: ${{ needs.release-please.outputs.release_created }}
33+
steps:
34+
- name: Login to Docker Registry
35+
uses: docker/login-action@v3
36+
with:
37+
registry: ghcr.io
38+
username: ${{ github.actor }}
39+
password: ${{ secrets.GITHUB_TOKEN }}
40+
- name: Build and push
41+
uses: docker/build-push-action@v5
42+
with:
43+
push: true
44+
tags: ghcr.io/ptah-sh/ptah-server:latest,ghcr.io/ptah-sh/ptah-server:${{ needs.release-please.outputs.tag_name }}
45+
# TODO: should we create a github deployment?
46+
deploy:
47+
runs-on: ubuntu-latest
48+
needs:
49+
- release-please
50+
- build-and-publish
51+
if: ${{ needs.release-please.outputs.release_created }}
52+
steps:
53+
- name: Deploy
54+
run: |
55+
curl --fail-with-body -X POST \
56+
-H 'Content-Type: application/json' \
57+
-H 'Accept: application/json' \
58+
-H 'X-Ptah-Token: ${{ secrets.PTAH_TOKEN }}' \
59+
-d '{"processes":[{"name":"svc","dockerImage":"ghcr.io/ptah-sh/ptah-server:${{ needs.release-please.outputs.tag_name }}"}]}' \
60+
https://app.ptah.sh/api/v0/services/2/deploy

Diff for: Dockerfile

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
FROM bitnami/php-fpm:latest
2+
3+
RUN install_packages nodejs npm \
4+
&& apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives
5+
6+
WORKDIR /app
7+
8+
ENV COMPOSER_ALLOW_SUPERUSER=1
9+
10+
COPY package.json .
11+
COPY package-lock.json .
12+
13+
RUN npm i --frozen-lockfile
14+
15+
COPY composer.json .
16+
COPY composer.lock .
17+
18+
RUN composer install --no-scripts
19+
20+
COPY . .
21+
22+
RUN composer install
23+
24+
RUN npm run build \
25+
&& apt-get -y remove npm \
26+
&& apt-get -y autoremove \

0 commit comments

Comments
 (0)