Skip to content

Commit

Permalink
Merge pull request #1 from truenas/make-rootless
Browse files Browse the repository at this point in the history
Improve dockerfile
  • Loading branch information
kmoore134 authored Nov 19, 2024
2 parents d0957bf + 4179913 commit fab912c
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 17 deletions.
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 <[email protected]>

LABEL org.opencontainers.image.authors="[email protected]"

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

0 comments on commit fab912c

Please sign in to comment.