<commit_before>#!/bin/bash -e

# See documentation in README.md

DOCKER="$(command -v podman || command -v docker)"

DOCKER_DIR="$(dirname "${0}")"
VOLUME_OPTIONS=""
CAPABILITIES=""
RELEASE="testing"

if [ "$(basename "${DOCKER}")" = "podman" ]; then
  IS_DOCKER=false
else
  IS_DOCKER=true
fi

if [ "${OSTYPE}" == "linux-gnu" ] && [ "$(basename "${DOCKER}")" = "podman" ]; then
  CAPABILITIES="--cap-add=CAP_SYS_PTRACE";
fi

if [ ! -z "${1}" ]; then
  RELEASE="${1}"
fi

IMAGE_NAME="simde-dev-${RELEASE}"

# (Re)build image
# We only do this if the current image is older than a week (if jq is installed)
BUILD_IMAGE=auto
if [ "$IS_DOCKER" = true ]; then
  BUILD_CUTOFF_TIME="$(expr $(date +%s) - \( 60 \* 60 \* 24 \* 7 \))"
  DATE="$(docker images "${IMAGE_NAME}" --format '{{ .CreatedAt }}' | awk '{ print $1 " " $2 }')"

  if [ "$(uname)" == "Darwin" ]; then
    CURRENT_IMAGE_CREATED="$(date -jf "%Y-%m-%d %H:%M:%S" "$DATE" +%s)"
  else
    CURRENT_IMAGE_CREATED="$(date +"%s" -d "$DATE")"
  fi

  if [ -z "${CURRENT_IMAGE_CREATED}" ]; then
    BUILD_IMAGE=y
  elif [ ${CURRENT_IMAGE_CREATED} -lt ${BUILD_CUTOFF_TIME} ]; then<commit_msg>docker: skip date check when building image for the first time<commit_after>#!/bin/bash -e

# See documentation in README.md

DOCKER="$(command -v podman || command -v docker)"

DOCKER_DIR="$(dirname "${0}")"
VOLUME_OPTIONS=""
CAPABILITIES=""
RELEASE="testing"

if [ "$(basename "${DOCKER}")" = "podman" ]; then
  IS_DOCKER=false
else
  IS_DOCKER=true
fi

if [ "${OSTYPE}" == "linux-gnu" ] && [ "$(basename "${DOCKER}")" = "podman" ]; then
  CAPABILITIES="--cap-add=CAP_SYS_PTRACE";
fi

if [ ! -z "${1}" ]; then
  RELEASE="${1}"
fi

IMAGE_NAME="simde-dev-${RELEASE}"

# (Re)build image
# We only do this if the current image is older than a week (if jq is installed)
BUILD_IMAGE=auto
if [ "$IS_DOCKER" = true ]; then
  BUILD_CUTOFF_TIME="$(expr $(date +%s) - \( 60 \* 60 \* 24 \* 7 \))"
  DATE="$(docker images "${IMAGE_NAME}" --format '{{ .CreatedAt }}' | awk '{ print $1 " " $2 }')"

  if [ "$(uname)" == "Darwin" ]; then
    CURRENT_IMAGE_CREATED="$(date -jf "%Y-%m-%d %H:%M:%S" "$DATE" +%s)"
  else
    CURRENT_IMAGE_CREATED="$(date +"%s" -d "$DATE")"
  fi

  if [[ -z "${CURRENT_IMAGE_CREATED}" || -z "${DATE}" ]]; then
    BUILD_IMAGE=y
  elif [ ${CURRENT_IMAGE_CREATED} -lt ${BUILD_CUTOFF_TIME} ]; then
{'fraction_non_alphanumeric': 0.2216078264568269, 'fraction_numerical': 0.010208421948107189, 'mean_word_length': 4.19205298013245, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2053568', 'n_tokens_mistral': 974, 'n_tokens_neox': 906, 'n_words': 227}