Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve dockerfile #1

Merged
merged 9 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 24 additions & 8 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,22 @@ name: Docker

on:
schedule:
- cron: '32 18 * * *'
- cron: "32 18 * * *"
push:
branches: [ "master" ]
branches: ["master"]
# Publish semver tags as releases.
tags: [ 'v*.*.*' ]
tags: ["v*.*.*"]
pull_request:
branches: [ "master" ]
branches: ["master"]

env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}


jobs:
build:

runs-on: ubuntu-latest
permissions:
contents: read
Expand All @@ -43,7 +41,7 @@ jobs:
if: github.event_name != 'pull_request'
uses: sigstore/cosign-installer@59acb6260d9c0ba8f4a2f9d9b48431a222b68e20 #v3.5.0
with:
cosign-release: 'v2.2.4'
cosign-release: "v2.2.4"

# Set up BuildKit Docker container builder to be able to build
# multi-platform images and export cache
Expand All @@ -69,6 +67,21 @@ jobs:
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Get Version
id: get_version
shell: bash
run: |
sudo ./install-iconik.sh
echo "Getting version"
echo $(/opt/iconik/iconik_storage_gateway/iconik_storage_gateway --version)
version=$(/opt/iconik/iconik_storage_gateway/iconik_storage_gateway --version | grep -o '[0-9]\+\.[0-9]\+\.[0-9]\+')
echo "Version: ${version}"
echo "version=${version}" >> $GITHUB_OUTPUT
if [ -z "$version" ]; then
echo "Failed to get version"
exit 1
fi

# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
Expand All @@ -77,7 +90,10 @@ jobs:
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
tags: |
${{ steps.meta.outputs.tags }}
ghcr.io/${{ github.repository }}:latest
ghcr.io/${{ github.repository }}:${{ steps.get_version.outputs.version }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
Expand Down
21 changes: 12 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
FROM ubuntu:jammy
MAINTAINER iconik Media AB <info@iconik.io>

LABEL org.opencontainers.image.authors="dev@ixsystems.com"

RUN apt-get update && \
apt-get install -y ffmpeg imagemagick poppler-utils ghostscript dcraw exiftool locales && rm -rf /var/lib/apt/lists/* \
&& localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
ENV LANG en_US.utf8
ENV LANG=en_US.utf8

ARG REPO_BASE=https://packages.iconik.io/deb/ubuntu
COPY ./install-iconik.sh /tmp/install-iconik.sh
RUN /tmp/install-iconik.sh
RUN \
apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
rm /tmp/install-iconik.sh

RUN apt-get update && apt-get install -y wget gnupg && \
wget -O - ${REPO_BASE}/dists/jammy/iconik_package_repos_pub.asc | apt-key add - && \
echo "deb [trusted=yes] ${REPO_BASE} ./jammy main" > /etc/apt/sources.list.d/iconik.list && \
apt-get update && \
apt-get install -y iconik-storage-gateway
VOLUME /var/iconik/iconik_storage_gateway/data
CMD /opt/iconik/iconik_storage_gateway/iconik_storage_gateway \

ENTRYPOINT /opt/iconik/iconik_storage_gateway/iconik_storage_gateway \
--iconik-url=${ICONIK_URL:-https://app-lb.iconik.io/} \
--auth-token=${AUTH_TOKEN} \
--app-id=${APP_ID} \
Expand Down
10 changes: 10 additions & 0 deletions install-iconik.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash
set -e

REPO_BASE=https://packages.iconik.io/deb/ubuntu

apt-get update && apt-get install -y wget gnupg
wget -O - ${REPO_BASE}/dists/jammy/iconik_package_repos_pub.asc | apt-key add -
echo "deb [trusted=yes] ${REPO_BASE} ./jammy main" >/etc/apt/sources.list.d/iconik.list
apt-get update
apt-get install -y iconik-storage-gateway