Commit ac573f33 by Madhan Neethiraj

ATLAS-3934: Dockerfile: moved environment variables to .env file - #3

parent 9a605b66
BUILD_HOST_SRC=true
SKIPTESTS=true
GIT_URL=https://github.com/apache/atlas.git
BRANCH=master
PROFILE=dist,berkeley-solr
ATLAS_VERSION=3.0.0-SNAPSHOT
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
FROM atlas-base:latest FROM atlas-base:latest
ARG ATLAS_VERSION
COPY ./scripts/atlas.sh ${ATLAS_SCRIPTS}/ COPY ./scripts/atlas.sh ${ATLAS_SCRIPTS}/
COPY ./dist/apache-atlas-${ATLAS_VERSION}-bin.tar.gz /tmp/ COPY ./dist/apache-atlas-${ATLAS_VERSION}-bin.tar.gz /tmp/
...@@ -25,6 +26,8 @@ RUN tar xfz /tmp/apache-atlas-${ATLAS_VERSION}-bin.tar.gz --directory=/opt/ && \ ...@@ -25,6 +26,8 @@ RUN tar xfz /tmp/apache-atlas-${ATLAS_VERSION}-bin.tar.gz --directory=/opt/ && \
rm -f /tmp/apache-atlas-${ATLAS_VERSION}-bin.tar.gz && \ rm -f /tmp/apache-atlas-${ATLAS_VERSION}-bin.tar.gz && \
mkdir -p /var/run/atlas && \ mkdir -p /var/run/atlas && \
mkdir -p /var/log/atlas && \ mkdir -p /var/log/atlas && \
rm -rf ${ATLAS_HOME}/logs && \
ln -s /var/log/atlas ${ATLAS_HOME}/logs && \
chown -R atlas:atlas ${ATLAS_HOME}/ /var/run/atlas/ /var/log/atlas/ chown -R atlas:atlas ${ATLAS_HOME}/ /var/run/atlas/ /var/log/atlas/
ENTRYPOINT [ "/home/atlas/scripts/atlas.sh" ] ENTRYPOINT [ "/home/atlas/scripts/atlas.sh" ]
...@@ -17,8 +17,6 @@ ...@@ -17,8 +17,6 @@
FROM ubuntu:20.04 FROM ubuntu:20.04
ENV ATLAS_VERSION 3.0.0-SNAPSHOT
# Install curl, wget, tzdata, Python, Java # Install curl, wget, tzdata, Python, Java
RUN apt-get update && \ RUN apt-get update && \
DEBIAN_FRONTEND="noninteractive" apt-get -y install curl wget tzdata \ DEBIAN_FRONTEND="noninteractive" apt-get -y install curl wget tzdata \
......
...@@ -27,9 +27,6 @@ ENV PATH /usr/java/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/ ...@@ -27,9 +27,6 @@ ENV PATH /usr/java/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/
# setup atlas group, and users # setup atlas group, and users
RUN mkdir -p /home/atlas/git && \ RUN mkdir -p /home/atlas/git && \
mkdir -p /home/atlas/.m2 && \ mkdir -p /home/atlas/.m2 && \
mkdir -p /home/atlas/scripts && \
mkdir -p /home/atlas/patches && \
mkdir -p /home/atlas/dist && \
chown -R atlas:atlas /home/atlas chown -R atlas:atlas /home/atlas
COPY ./scripts/atlas-build.sh /home/atlas/scripts/ COPY ./scripts/atlas-build.sh /home/atlas/scripts/
......
...@@ -27,52 +27,50 @@ Docker files in this folder create docker images and run them to build Apache At ...@@ -27,52 +27,50 @@ Docker files in this folder create docker images and run them to build Apache At
2. Set this folder as your working directory. 2. Set this folder as your working directory.
3. Using docker-compose is the simpler way to build and deploy Apache Atlas in containers. 3. Update environment variables in .env file, if necessary
3.1. Execute following command to build Apache Atlas: 4. Using docker-compose is the simpler way to build and deploy Apache Atlas in containers.
4.1. Execute following command to build Apache Atlas:
docker-compose -f docker-compose.atlas-base.yml -f docker-compose.atlas-build.yml up docker-compose -f docker-compose.atlas-base.yml -f docker-compose.atlas-build.yml up
Time taken to complete the build might vary (upto an hour), depending on status of ${HOME}/.m2 directory cache. Time taken to complete the build might vary (upto an hour), depending on status of ${HOME}/.m2 directory cache.
3.2. Execute following command to install and start Atlas in a container: 4.2. Execute following command to install and start Atlas in a container:
docker-compose -f docker-compose.atlas-base.yml -f docker-compose.atlas.yml up -d docker-compose -f docker-compose.atlas-base.yml -f docker-compose.atlas.yml up -d
Apache Atlas will be installed at /opt/atlas/, and logs are at /opt/atlas/logs directory. Apache Atlas will be installed at /opt/atlas/, and logs are at /var/logs/atlas directory.
4. Alternatively docker command can be used to build and deploy Apache Atlas. 5. Alternatively docker command can be used to build and deploy Apache Atlas.
4.1. Execute following command to build Docker image **atlas-base**: 5.1. Execute following command to build Docker image **atlas-base**:
docker build -f Dockerfile.atlas-base -t atlas-base . docker build -f Dockerfile.atlas-base -t atlas-base .
This might take about 10 minutes to complete. This might take about 10 minutes to complete.
4.2. Execute following command to build Docker image **atlas-build**: 5.2. Execute following command to build Docker image **atlas-build**:
docker build -f Dockerfile.atlas-build -t atlas-build . docker build -f Dockerfile.atlas-build -t atlas-build .
4.3. Build Apache Atlas in a container with one of the following commands: 5.3. Build Apache Atlas in a container with one of the following commands:
# to build from a specific branch
docker run -it --rm -v ${HOME}/.m2:/home/atlas/.m2:delegated -v $(pwd)/scripts:/home/atlas/scripts -v $(pwd)/patches:/home/atlas/patches -v $(pwd)/dist:/home/atlas/dist -e BRANCH=master -e PROFILE=dist,berkeley-solr -e SKIPTESTS=true atlas-build
# to build from local sources docker run -it --rm -v ${HOME}/.m2:/home/atlas/.m2:delegated -v $(pwd)/scripts:/home/atlas/scripts -v $(pwd)/../..:/home/atlas/src:delegated -v $(pwd)/patches:/home/atlas/patches -v $(pwd)/dist:/home/atlas/dist --env-file ./.env atlas-build
docker run -it --rm -v ${HOME}/.m2:/home/atlas/.m2:delegated -v $(pwd)/scripts:/home/atlas/scripts -v $(pwd)/../..:/home/atlas/src:delegated -v $(pwd)/dist:/home/atlas/dist -e PROFILE=dist,berkeley-solr -e SKIPTESTS=true atlas-build
Time taken to complete the build might vary (upto an hour), depending on status of ${HOME}/.m2 directory cache. Time taken to complete the build might vary (upto an hour), depending on status of ${HOME}/.m2 directory cache.
4.4. Execute following command to build Docker image **atlas**: 5.4. Execute following command to build Docker image **atlas**:
docker build -f Dockerfile.atlas -t atlas . docker build -f Dockerfile.atlas --build-arg ATLAS_VERSION=3.0.0-SNAPSHOT -t atlas .
This might take about 10 minutes to complete. This might take about 10 minutes to complete.
4.8. Execute following command to install and run Atlas services in a container: 5.8. Execute following command to install and run Atlas services in a container:
docker run -it -d --name atlas --hostname atlas.example.com -p 21000:21000 atlas docker run -it -d --name atlas --hostname atlas.example.com -p 21000:21000 atlas
This might take few minutes to complete. This might take few minutes to complete.
5. Atlas Admin can be accessed at http://localhost:21000 (admin/atlasR0cks!) 6. Atlas Admin can be accessed at http://localhost:21000 (admin/atlasR0cks!)
...@@ -7,6 +7,8 @@ services: ...@@ -7,6 +7,8 @@ services:
image: atlas-base image: atlas-base
networks: networks:
- atlas - atlas
environment:
- ATLAS_VERSION
networks: networks:
atlas: atlas:
...@@ -20,9 +20,12 @@ services: ...@@ -20,9 +20,12 @@ services:
depends_on: depends_on:
- atlas-base - atlas-base
environment: environment:
BRANCH: 'master' - ATLAS_VERSION
SKIPTESTS: 'true' - BRANCH
PROFILE: 'dist,berkeley-solr' - BUILD_HOST_SRC
- GIT_URL
- PROFILE
- SKIPTESTS
networks: networks:
atlas: atlas:
...@@ -4,6 +4,8 @@ services: ...@@ -4,6 +4,8 @@ services:
build: build:
context: . context: .
dockerfile: Dockerfile.atlas dockerfile: Dockerfile.atlas
args:
- ATLAS_VERSION=${ATLAS_VERSION}
image: atlas:latest image: atlas:latest
container_name: atlas container_name: atlas
hostname: atlas.example.com hostname: atlas.example.com
...@@ -15,6 +17,8 @@ services: ...@@ -15,6 +17,8 @@ services:
- "21000:21000" - "21000:21000"
depends_on: depends_on:
- atlas-base - atlas-base
environment:
- ATLAS_VERSION
command: command:
- /home/atlas/scripts/atlas.sh - /home/atlas/scripts/atlas.sh
......
...@@ -38,12 +38,24 @@ else ...@@ -38,12 +38,24 @@ else
ARG_SKIPTESTS="-DskipTests=${SKIPTESTS}" ARG_SKIPTESTS="-DskipTests=${SKIPTESTS}"
fi fi
if [ "${BUILD_HOST_SRC}" == "" ]
then
BUILD_HOST_SRC=true
fi
export MAVEN_OPTS="-Xms2g -Xmx2g" export MAVEN_OPTS="-Xms2g -Xmx2g"
export M2=/home/atlas/.m2 export M2=/home/atlas/.m2
if [ -f /home/atlas/src/pom.xml ] if [ "${BUILD_HOST_SRC}" == "true" ]
then then
if [ ! -f /home/atlas/src/pom.xml ]
then
echo "ERROR: BUILD_HOST_SRC=${BUILD_HOST_SRC}, but /home/atlas/src/pom.xml is not found "
exit 1
fi
echo "Building from /home/atlas/src" echo "Building from /home/atlas/src"
cd /home/atlas/src cd /home/atlas/src
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment