-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #57 from fykosak/feature/docker-image
Docker image
- Loading branch information
Showing
9 changed files
with
125 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,34 @@ | ||
name: Create and publish a Docker image | ||
on: push | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }} | ||
|
||
jobs: | ||
build-and-push-image: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
- name: Log in to the Container registry | ||
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
- name: Build and push Docker image | ||
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} |
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,33 @@ | ||
# Compile Javascript and CSS | ||
FROM node:latest AS node-builder | ||
WORKDIR /usr/src/webs | ||
COPY . . | ||
RUN npm install && npm run build | ||
|
||
# Install PHP dependencies and init translations | ||
FROM composer as composer-builder | ||
WORKDIR /usr/src/webs | ||
COPY --from=node-builder /usr/src/webs /usr/src/webs | ||
RUN composer install --no-dev --no-interaction --no-progress --optimize-autoloader --ignore-platform-reqs | ||
|
||
# Prepare files for the final image | ||
RUN mkdir /usr/src/final | ||
RUN cp -r /usr/src/webs/app /usr/src/webs/www /usr/src/webs/vendor /usr/src/final/ | ||
|
||
# Final image | ||
FROM php:8.2-apache | ||
RUN apt-get update && apt install -y \ | ||
gettext \ | ||
locales \ | ||
&& docker-php-ext-configure gettext \ | ||
&& docker-php-ext-install \ | ||
gettext \ | ||
&& a2enmod rewrite \ | ||
&& sed -i -e 's/# cs_CZ.UTF-8/cs_CZ.UTF-8/' /etc/locale.gen \ | ||
&& sed -i -e 's/# en_US.UTF-8/en_US.UTF-8/' /etc/locale.gen \ | ||
&& dpkg-reconfigure --frontend=noninteractive locales | ||
|
||
USER www-data | ||
WORKDIR /var/www/webs | ||
COPY --chown=www-data --from=composer-builder /usr/src/final /var/www/webs/ | ||
RUN ./app/i18n/compile.sh |
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
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,6 @@ | ||
config/app/* | ||
!config/app/.gitkeep | ||
log/* | ||
!log/.gitkeep | ||
temp/* | ||
!temp/.gitkeep |
Empty file.
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 @@ | ||
<Directory /var/www/webs> | ||
AllowOverride All | ||
Require all granted | ||
</Directory> | ||
|
||
#SetEnv NETTE_DEVEL 1 | ||
SetEnv NETTE_EXTERNAL_LOCAL_CONFIG 1 | ||
|
||
<VirtualHost *:80> | ||
ServerName online.fyziklani.cz.local | ||
ServerAlias online.fyziklani.org.local | ||
DocumentRoot /var/www/webs/www/fol | ||
</VirtualHost> | ||
|
||
<VirtualHost *:80> | ||
ServerName fyziklani.cz.local | ||
ServerAlias fyziklani.org.local | ||
DocumentRoot /var/www/webs/www/fof | ||
</VirtualHost> | ||
|
||
<VirtualHost *:80> | ||
ServerName dsef.cz.local | ||
ServerAlias dsef.org.local | ||
DocumentRoot /var/www/webs/www/dsef | ||
</VirtualHost> | ||
|
||
<VirtualHost *:80> | ||
ServerName fykos.cz.local | ||
ServerAlias fykos.org.local | ||
DocumentRoot /var/www/webs/www/fykos | ||
</VirtualHost> |
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,16 @@ | ||
version: '3.5' | ||
services: | ||
app: | ||
build: .. | ||
ports: | ||
- "8080:80" | ||
user: "1000:1000" | ||
volumes: | ||
# Cache directory | ||
- "./temp:/var/www/webs/temp/" | ||
# Error logs | ||
- "./log:/var/www/webs/log/" | ||
# Apache configuration | ||
- "./config/webs.conf:/etc/apache2/sites-enabled/000-default.conf" | ||
# App configuration | ||
- "./config/app:/var/www/webs/app/config/local/" |
Empty file.
Empty file.