Skip to content

Commit

Permalink
move python to a diffrent image
Browse files Browse the repository at this point in the history
  • Loading branch information
Zoey2936 committed Apr 20, 2024
1 parent 4aea247 commit 5ef1ef0
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 2 deletions.
24 changes: 23 additions & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,19 @@ jobs:
ghcr.io/${{ steps.un.outputs.un }}/${{ github.event.repository.name }}:${{ github.run_number }}
build-args: |
"BUILD=${{ github.event.repository.name }}"
- name: Build
uses: docker/build-push-action@v5
if: ${{ github.event_name != 'pull_request' }}
with:
context: .
file: ./python.Dockerfile
platforms: linux/amd64,linux/arm64 #,linux/amd64/v2,linux/amd64/v3,linux/amd64/v4 #,linux/ppc64le,linux/s390x,linux/386,linux/arm/v7,linux/arm/v6
push: ${{ github.event_name != 'pull_request' }}
tags: |
${{ steps.un.outputs.un }}/${{ github.event.repository.name }}:python-${{ github.ref_name }}
${{ steps.un.outputs.un }}/${{ github.event.repository.name }}:python-${{ github.run_number }}
ghcr.io/${{ steps.un.outputs.un }}/${{ github.event.repository.name }}:python-${{ github.ref_name }}
ghcr.io/${{ steps.un.outputs.un }}/${{ github.event.repository.name }}:python-${{ github.run_number }}
- name: show version
if: ${{ github.event_name != 'pull_request' }}
run: |
Expand Down Expand Up @@ -116,9 +129,18 @@ jobs:
tags: ghcr.io/${{ steps.un.outputs.un }}/${{ github.event.repository.name }}:${{ steps.pr.outputs.pr }}
build-args: |
"BUILD=${{ github.event.repository.name }}"
- name: Build (PR)
uses: docker/build-push-action@v5
if: ${{ github.event_name == 'pull_request' }}
with:
context: .
file: ./python.Dockerfile
platforms: linux/amd64,linux/arm64 #,linux/amd64/v2,linux/amd64/v3,linux/amd64/v4 #,linux/ppc64le,linux/s390x,linux/386,linux/arm/v7,linux/arm/v6
push: ${{ github.event_name == 'pull_request' }}
tags: ghcr.io/${{ steps.un.outputs.un }}/${{ github.event.repository.name }}:${{ steps.pr.outputs.pr }}
- name: show version (PR)
if: ${{ github.event_name == 'pull_request' }}
run: docker run --rm ghcr.io/${{ steps.un.outputs.un }}/${{ github.event.repository.name }}:${{ steps.pr.outputs.pr }} -V
run: docker run --rm ghcr.io/${{ steps.un.outputs.un }}/${{ github.event.repository.name }}:python-${{ steps.pr.outputs.pr }} -V
- name: copy nginx (PR)
if: ${{ github.event_name == 'pull_request' }}
run: |
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ RUN cd /src/nginx && \
make -j "$(nproc)" install PREFIX=/usr/local/nginx && \
perl /src/openssl/configdata.pm --dump

FROM python:3.12.3-alpine3.19
FROM alpine:3.19.1
COPY --from=build /usr/local/nginx /usr/local/nginx
#COPY --from=build /usr/local/lib/perl5 /usr/local/lib/perl5 # perl in apk add needed
#COPY --from=build /usr/lib/perl5/core_perl/perllocal.pod /usr/lib/perl5/core_perl/perllocal.pod # perl in apk add needed
Expand Down
13 changes: 13 additions & 0 deletions python.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# syntax=docker/dockerfile:labs
FROM python:3.12.3-alpine3.19
COPY --from=zoeyvid/nginx-quic:latest /usr/local/nginx /usr/local/nginx
#COPY --from=zoeyvid/nginx-quic:latest /usr/local/lib/perl5 /usr/local/lib/perl5 # perl in apk add needed
#COPY --from=zoeyvid/nginx-quic:latest /usr/lib/perl5/core_perl/perllocal.pod /usr/lib/perl5/core_perl/perllocal.pod # perl in apk add needed
COPY --from=zoeyvid/nginx-quic:latest /usr/local/modsecurity/lib/libmodsecurity.so.3 /usr/local/modsecurity/lib/libmodsecurity.so.3
COPY --from=zoeyvid/nginx-quic:latest /src/ModSecurity/unicode.mapping /usr/local/nginx/conf/conf.d/include/unicode.mapping
COPY --from=zoeyvid/nginx-quic:latest /src/ModSecurity/modsecurity.conf-recommended /usr/local/nginx/conf/conf.d/include/modsecurity.conf.example
RUN apk upgrade --no-cache -a && \
apk add --no-cache ca-certificates tzdata tini zlib luajit pcre2 libstdc++ yajl libxml2 libxslt libcurl lmdb libfuzzy2 lua5.1-libs geoip libmaxminddb-libs && \
ln -s /usr/local/nginx/sbin/nginx /usr/local/bin/nginx
ENTRYPOINT ["tini", "--", "nginx"]
CMD ["-g", "daemon off;"]

0 comments on commit 5ef1ef0

Please sign in to comment.