# syntax = docker/dockerfile:1.0-experimental
FROM ubuntu:18.04

# From https://github.com/jbrazda/ic-sagent-docker

MAINTAINER Eric Schoville <>

# POD and REGION can be inferred from the web URL of your Informatica Cloud site.
# The values for POD and REGION probably need changing for you.  Setting these as
# default for UW-Madison hosted service

ARG POD=usw3
ARG REGION=dm-us
ENV POD=$POD
ENV REGION=$REGION

# You should be able to download the Secure Agent binary from the following URL without authentication:

ARG AGENT_URL="https://${POD}.${REGION}.informaticacloud.com/saas/download/linux64/installer/agent64_install_ng_ext.bin"
ARG USER=agent
ARG WORK_DIR=/home/$USER/infaagent/apps/agentcore

# install system tools
RUN apt-get update && apt-get install -y \
curl \
less \
locales \
locales-all \
sudo \
unzip \
jq

# Set the locale, Locale defaults are necessary for agent to operate correctly
RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && locale-gen
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8

# We need to run docker image under a different user than root
# Secure agent process engine can't be run under root account
RUN useradd --create-home -ms /bin/bash -U $USER
RUN mkdir /exports && chown $USER:$USER /exports
USER $USER

# 1. Download and prepare Installer
# 2. Set file permissions
# 3. Install using silent install and the default location
# 4. Cleanup
RUN curl -o /tmp/agent64_install.bin $AGENT_URL && \
chmod +x /tmp/agent64_install.bin && \
/tmp/agent64_install.bin -i silent && \
rm -rf /tmp/agent64_install.bin

WORKDIR $WORK_DIR

COPY run_agent.sh .

CMD [ "./run_agent.sh" ]