Skip to content

Commit

Permalink
dockerfile improving (#66)
Browse files Browse the repository at this point in the history
  • Loading branch information
tarampampam authored Feb 2, 2025
1 parent 46cfd03 commit 29d2351
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 26 deletions.
22 changes: 1 addition & 21 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,27 +24,9 @@ jobs:
- {uses: actions/checkout@v4, with: {fetch-depth: 0}}
- uses: gacts/gitleaks@v1

filter:
name: Filter files
runs-on: ubuntu-latest
permissions: {pull-requests: read}
outputs:
docker: ${{ steps.filter.outputs.docker }}
helm: ${{ steps.filter.outputs.helm }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
docker: [Dockerfile, '*docker*', '*3proxy*']
helm: ['deployments/helm/**', '*kube*']
lint-charts:
name: Lint the chart
runs-on: ubuntu-latest
needs: [filter]
if: needs.filter.outputs.helm == 'true'
defaults: {run: {working-directory: ./deployments/helm}}
steps:
- uses: actions/checkout@v4
Expand All @@ -56,8 +38,6 @@ jobs:
build-image:
name: Build the docker image
runs-on: ubuntu-latest
needs: [filter] # since this is the initial step, we can filter out the rest of the jobs right here to skip them
if: needs.filter.outputs.docker == 'true'
steps:
- uses: actions/checkout@v4
- run: docker build -f ./Dockerfile --tag 3proxy:local .
Expand All @@ -69,7 +49,7 @@ jobs:
retention-days: 1

try-to-use:
name: Build and use the docker image (auth ${{ matrix.auth }})
name: Try to use the docker image (auth ${{ matrix.auth }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand Down
11 changes: 6 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# syntax=docker/dockerfile:1

FROM gcc:13.3.0 AS builder
FROM docker.io/library/gcc:13.3.0 AS builder

# renovate: source=github-tags name=3proxy/3proxy
ARG Z3PROXY_VERSION=0.9.4
Expand Down Expand Up @@ -34,10 +34,11 @@ RUN set -x \
&& strip ./bin/TrafficPlugin.ld.so \
&& strip ./bin/PCREPlugin.ld.so \
&& strip ./bin/TransparentPlugin.ld.so \
&& strip ./bin/SSLPlugin.ld.so
&& strip ./bin/SSLPlugin.ld.so \
&& cp /lib/$(gcc -dumpmachine)/libdl.so.* /tmp/3proxy/

# Prepare filesystem for 3proxy running
FROM alpine:latest AS buffer
FROM docker.io/library/alpine:latest AS buffer

# create a directory for the future root filesystem
WORKDIR /tmp/rootfs
Expand All @@ -53,7 +54,7 @@ RUN set -x \
&& chmod +x ./bin/dumb-init \
&& apk del .build-deps

COPY --from=builder /lib/*-linux-gnu/libdl.so.* ./lib/
COPY --from=builder /tmp/3proxy/libdl.so.* ./lib/
COPY --from=builder /tmp/3proxy/bin/3proxy ./bin/3proxy
COPY --from=builder /tmp/3proxy/bin/*.ld.so ./usr/local/3proxy/libexec/
COPY --from=ghcr.io/tarampampam/mustpl:0.1.1 /bin/mustpl ./bin/mustpl
Expand All @@ -63,7 +64,7 @@ COPY 3proxy.cfg.mustach ./etc/3proxy/3proxy.cfg.mustach
RUN chown -R 10001:10001 ./etc/3proxy

# Merge into a single layer
FROM busybox:stable-glibc
FROM docker.io/library/busybox:stable-glibc

LABEL \
org.opencontainers.image.title="3proxy" \
Expand Down

0 comments on commit 29d2351

Please sign in to comment.