Skip to content

Commit

Permalink
build Docker file
Browse files Browse the repository at this point in the history
  • Loading branch information
splitbrain committed Sep 3, 2024
1 parent aa91848 commit 7201990
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 10 deletions.
25 changes: 15 additions & 10 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand All @@ -19,15 +19,20 @@ jobs:
- name: Run Composer
run: composer install

- name: Setup SSH Key
uses: shimataro/ssh-key-action@v2
# Log in to the GitHub Container Registry
- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
with:
key: ${{ secrets.SSH_PRIVATE_KEY }}
# generate with ssh-keyscan -H <server>
known_hosts: ${{ secrets.SSH_KNOWN_HOSTS }}
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Deploy to Server
# Build the Docker image
- name: Build Docker image
run: |
chmod 777 data
rsync -avz ./ ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}:${{ secrets.TARGET_DIR }}
docker build -t ghcr.io/${{ github.repository }}:latest .
# Push the Docker image to GitHub Container Registry
- name: Push Docker image
run: |
docker push ghcr.io/${{ github.repository }}:latest
10 changes: 10 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM php:8.3-apache

RUN sed -ri -e 's!/var/www/html!/app/public!g' /etc/apache2/sites-available/*.conf
RUN sed -ri -e 's!/var/www/!/app/public!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
RUN a2enmod rewrite

VOLUME /app/data
WORKDIR /app
COPY ./ /app
8 changes: 8 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
services:
web:
build: .
ports:
- "8000:80"
user: "1000:1000"
volumes:
- ./data:/app/data

0 comments on commit 7201990

Please sign in to comment.