Skip to content

Include openssl in dockerfile #117

Include openssl in dockerfile

Include openssl in dockerfile #117

Workflow file for this run

name: Docker
on:
push:
tags:
- "sushii-2-v*"
- "sushii-api-v*"
- "sushii-feeds-v*"
- "sushii-webhooks-v*"
env:
SUSHII_2_IMAGE_NAME: ghcr.io/sushiibot/sushii-2
SUSHII_API_IMAGE_NAME: ghcr.io/sushiibot/sushii-api
SUSHII_FEEDS_IMAGE_NAME: ghcr.io/sushiibot/sushii-feeds
SUSHII_WEBHOOKS_IMAGE_NAME: ghcr.io/sushiibot/sushii-webhooks
jobs:
push:
name: Build and publish Docker Image
runs-on: ubuntu-latest
if: github.event_name == 'push'
steps:
- uses: actions/checkout@v2
- name: Select image
id: docker_image_select
run: |
echo ${GITHUB_REF#refs/*/}
if [[ ${GITHUB_REF#refs/*/} == sushii-2* ]]
then
echo ::set-output name=image::${{ env.SUSHII_2_IMAGE_NAME}}
echo ::set-output name=docker_file::"./sushii-2/Dockerfile"
echo ::set-output name=title::"sushii-2"
echo ::set-output name=description::"Moderation bot for Discord"
exit 0
fi
if [[ ${GITHUB_REF#refs/*/} == sushii-api* ]]
then
echo ::set-output name=image::${{ env.SUSHII_API_IMAGE_NAME}}
echo ::set-output name=docker_file::"./sushii-api/Dockerfile"
echo ::set-output name=title::"sushii-api"
echo ::set-output name=description::"GraphQL API server for sushii2"
exit 0
fi
if [[ ${GITHUB_REF#refs/*/} == sushii-feeds* ]]
then
echo ::set-output name=image::${{ env.SUSHII_FEEDS_IMAGE_NAME}}
echo ::set-output name=docker_file::"./sushii-feeds/Dockerfile"
echo ::set-output name=title::"sushii-feeds"
echo ::set-output name=description::"gRPC feed fetching service for sushii2"
exit 0
fi
if [[ ${GITHUB_REF#refs/*/} == sushii-webhooks* ]]
then
echo ::set-output name=image::${{ env.SUSHII_WEBHOOKS_IMAGE_NAME}}
echo ::set-output name=docker_file::"./Dockerfile"
echo ::set-output name=title::"sushii-webhooks"
echo ::set-output name=build_args::"TARGET=sushii-webhooks"
echo ::set-output name=description::"Webhook service for sushii"
exit 0
fi
echo "Tags did not match packages"
exit 1
- name: Docker meta
id: docker_meta
uses: crazy-max/ghaction-docker-meta@v1
with:
images: ${{ steps.docker_image_select.outputs.image}}
tag-match: "v(.*)"
tag-match-group: "1"
tag-sha: true
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Login to Github Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.CR_PAT }}
- name: Build and push image to GitHub Packages
uses: docker/build-push-action@v2
with:
context: .
build-args: ${{ steps.docker_image_select.outputs.build_args }}
file: ${{ steps.docker_image_select.outputs.docker_file }}
push: true
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new
tags: ${{ steps.docker_meta.outputs.tags }}
labels: |
${{ steps.docker_meta.outputs.labels }}
org.opencontainers.image.title=${{ steps.docker_image_select.outputs.title }}
org.opencontainers.image.description=${{ steps.docker_image_select.outputs.description }}
# https://github.com/docker/build-push-action/blob/master/docs/advanced/cache.md#github-cache
# Temp fix
# https://github.com/docker/build-push-action/issues/252
# https://github.com/moby/buildkit/issues/1896
- name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache