action: add docker build CI and update openssl for docker image.
This commit is contained in:
35
.github/workflows/docker.yml
vendored
Normal file
35
.github/workflows/docker.yml
vendored
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
name: Publish Docker Image
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
version:
|
||||||
|
description: 'new image tag(e.g. v1.1.0)'
|
||||||
|
required: true
|
||||||
|
default: 'latest'
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
docker:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v2
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v2
|
||||||
|
- name: Login to DockerHub
|
||||||
|
uses: docker/login-action@v2
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
- name: Build and push
|
||||||
|
uses: docker/build-push-action@v3
|
||||||
|
with:
|
||||||
|
platforms: linux/amd64,linux/arm64
|
||||||
|
push: true
|
||||||
|
tags: ${{vars.DOCKERHUB_REPO}}:${{ github.event.inputs.version }}
|
||||||
@@ -2,7 +2,7 @@ FROM ubuntu:latest as smartdns-builder
|
|||||||
LABEL previous-stage=smartdns-builder
|
LABEL previous-stage=smartdns-builder
|
||||||
|
|
||||||
# prepare builder
|
# prepare builder
|
||||||
ARG OPENSSL_VER=1.1.1f
|
ARG OPENSSL_VER=3.0.10
|
||||||
RUN apt update && \
|
RUN apt update && \
|
||||||
apt install -y perl curl make musl-tools musl-dev && \
|
apt install -y perl curl make musl-tools musl-dev && \
|
||||||
ln -s /usr/include/linux /usr/include/$(uname -m)-linux-musl && \
|
ln -s /usr/include/linux /usr/include/$(uname -m)-linux-musl && \
|
||||||
@@ -27,7 +27,7 @@ COPY . /build/smartdns/
|
|||||||
RUN cd /build/smartdns && \
|
RUN cd /build/smartdns && \
|
||||||
export CC=musl-gcc && \
|
export CC=musl-gcc && \
|
||||||
export CFLAGS="-I /opt/build/include" && \
|
export CFLAGS="-I /opt/build/include" && \
|
||||||
export LDFLAGS="-L /opt/build/lib" && \
|
export LDFLAGS="-L /opt/build/lib -L /opt/build/lib64" && \
|
||||||
sh ./package/build-pkg.sh --platform linux --arch `dpkg --print-architecture` --static && \
|
sh ./package/build-pkg.sh --platform linux --arch `dpkg --print-architecture` --static && \
|
||||||
\
|
\
|
||||||
( cd package && tar -xvf *.tar.gz && chmod a+x smartdns/etc/init.d/smartdns ) && \
|
( cd package && tar -xvf *.tar.gz && chmod a+x smartdns/etc/init.d/smartdns ) && \
|
||||||
@@ -37,9 +37,9 @@ RUN cd /build/smartdns && \
|
|||||||
cp package/smartdns/usr /release/ -a && \
|
cp package/smartdns/usr /release/ -a && \
|
||||||
cd / && rm -rf /build
|
cd / && rm -rf /build
|
||||||
|
|
||||||
FROM busybox:latest
|
FROM busybox:stable-musl
|
||||||
COPY --from=smartdns-builder /release/ /
|
COPY --from=smartdns-builder /release/ /
|
||||||
EXPOSE 53/udp
|
EXPOSE 53/udp
|
||||||
VOLUME "/etc/smartdns/"
|
VOLUME ["/etc/smartdns/"]
|
||||||
|
|
||||||
CMD ["/usr/sbin/smartdns", "-f", "-x"]
|
CMD ["/usr/sbin/smartdns", "-f", "-x"]
|
||||||
|
|||||||
Reference in New Issue
Block a user