Skip to content

Commit

Permalink
Support multiple Dockerfiles
Browse files Browse the repository at this point in the history
  • Loading branch information
WyriHaximus committed Dec 20, 2024
1 parent b1a46b8 commit afb7ece
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ jobs:
expected: '["linux/arm64","linux/amd64"]'
with:
image: ghcr.io/home-assistant/home-assistant:2024.12.2,ghcr.io/wyrihaximusnet/php:8.3-zts-alpine-dev
- name: Multiple Dockerfiles
expected: '["linux/amd64","linux/arm64"]'
with:
dockerfile: tests/Dockerfile*
steps:
- uses: actions/checkout@v4
- name: OCI Image Supported Platforms
Expand Down
2 changes: 1 addition & 1 deletion action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ runs:
if: inputs.image == ''
shell: bash
run: |
printf "from=%s" $(cat ${{ inputs.dockerfile }} | grep FROM | tail -n 1 | docker run -q -i --rm ghcr.io/wyrihaximusnet/php:8.3-nts-alpine-slim php -r 'echo explode(" ", trim(fgets(STDIN)))[1];') >> $GITHUB_OUTPUT
printf "from=%s" $(cat ${{ inputs.dockerfile }} | grep FROM | xargs -I % docker run -q -i --rm ghcr.io/wyrihaximusnet/php:8.3-nts-alpine-slim php -r 'echo explode(" ", trim("%"))[1], ",";' | head -c -1) >> $GITHUB_OUTPUT
- name: Image 🧙
id: image
shell: bash
Expand Down
21 changes: 21 additions & 0 deletions tests/Dockerfile-nodejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM node:22-alpine3.20

RUN set -x \
&& addgroup -g 666 app \
&& adduser -u 666 -D -G app app

EXPOSE 7132
EXPOSE 7133

RUN mkdir -p /opt/app
WORKDIR /opt/app

COPY ./ /opt/app/

USER root
RUN chown app:app /opt/app/ -Rfv
USER app

RUN npm install

ENTRYPOINT ["node", "/opt/app/app.js"]
24 changes: 24 additions & 0 deletions tests/Dockerfile-reactphp
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
FROM wyrihaximusnet/php:8.4-nts-alpine-slim-dev AS install-dependencies

WORKDIR /opt/app
USER root
RUN mkdir /opt/app/vendor && chown app:app /opt/app -Rfv
USER app

COPY ./composer.* /opt/app/
RUN composer install --ansi --no-interaction --prefer-dist --no-dev -o

FROM wyrihaximusnet/php:8.4-nts-alpine-slim

EXPOSE 7132
EXPOSE 7133
WORKDIR /opt/app

COPY ./ /opt/app/
COPY --from=install-dependencies /opt/app/vendor/ /opt/app/vendor/

USER root
RUN chown app:app /opt/app/ -Rf
USER app

ENTRYPOINT ["php", "/opt/app/app.php"]

0 comments on commit afb7ece

Please sign in to comment.