Skip to content

feat: update dockerfile #9

feat: update dockerfile

feat: update dockerfile #9

Workflow file for this run

name: buildx
on:
workflow_dispatch:
push:
branches:
- 'main'
env:
IMAGE_NAME: ghcr.io/${{ github.repository }}
jobs:
buildx:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Buildx
uses: docker/setup-buildx-action@v3
- name: Initial Buildx
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile
tags: ${{ env.IMAGE_NAME }}:testing
platforms: linux/amd64
- name: Load Built Image and Test
run: |
docker buildx build \
-t ${{ env.IMAGE_NAME }}:testing \
--platform=linux/amd64 \
--load \
.
CID=$(docker run -d ${{ env.IMAGE_NAME }}:testing)
sleep 5s
if [ $(docker exec -i $CID wireproxy --help | head -1 | cut -d ' ' -f2) != "wireproxy" ]; then
exit 1
fi
- name: Login to ghcr.io
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Buildx and Push
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile
tags: |
${{ env.IMAGE_NAME }}:latest
platforms: linux/amd64
push: true
- name: Cache slim
id: cache-slim
uses: actions/cache@v2
with:
path: ./dist_linux/
key: $runner.OS -slim-cache-$hashFiles('docker-slim') }}
restore-keys: |
$runner.OS -slim-cache-$hashFiles('docker-slim')
$runner.OS -slim-cache-
- name: Download SlimToolkit
if: steps.cache-slim.outputs.cache-hit != 'true'
run: |
wget https://downloads.dockerslim.com/releases/1.37.3/dist_linux.tar.gz
tar zxvf dist_linux.tar.gz
chmod +x ./dist_linux/docker-slim
- name: Minify
run: |
./dist_linux/docker-slim build --tag ${{ env.IMAGE_NAME }}:slim --dockerfile Dockerfile . && \
docker push ${{ env.IMAGE_NAME }}:slim