Skip to content
This repository has been archived by the owner on Jun 25, 2024. It is now read-only.

Add support for ARM64 in Dockerfile #24

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
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
25 changes: 19 additions & 6 deletions .build/azure-pipelines-job-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
command: login

- task: Docker@2
displayName: Build
displayName: Build for AMD architecture
inputs:
command: build
containerRegistry: 'DockerHub'
Expand All @@ -25,13 +25,26 @@ jobs:
$(DBCVER)-$(Build.BuildId)
$(DBCVER)
arguments: --build-arg DBCVER=$(DBCVER)

- task: Docker@2
displayName: Push
displayName: Build for ARM architecture
inputs:
command: push
command: build
Dockerfile: Dockerfile_ARM64
containerRegistry: 'DockerHub'
repository: datathirstltd/dbconnect
tags: |
$(DBCVER)-$(Build.BuildId)
$(DBCVER)
$(DBCVER)-$(Build.BuildId)-arm64
$(DBCVER)-arm64
arguments: --build-arg DBCVER=$(DBCVER) --platform linux/arm64/v8

# - task: Docker@2
# displayName: Push
# inputs:
# command: push
# containerRegistry: 'DockerHub'
# repository: datathirstltd/dbconnect
# tags: |
# $(DBCVER)-$(Build.BuildId)
# $(DBCVER)
# $(DBCVER)-$(Build.BuildId)-arm64
# $(DBCVER)-arm64
1 change: 0 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,3 @@ ENV DEBIAN_FRONTEND=dialog

# Allow for a consistant java home location for settings - image is changing over time
RUN if [ ! -d "/docker-java-home" ]; then ln -s "${JAVA_HOME}" /docker-java-home; fi

71 changes: 71 additions & 0 deletions Dockerfile_ARM64
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#-------------------------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information.
#-------------------------------------------------------------------------------------------------------------
FROM arm64v8/openjdk:8-jdk

# This Dockerfile adds a non-root user with sudo access. Use the "remoteUser"
# property in devcontainer.json to use it. On Linux, the container user's GID/UIDs
# will be updated to match your local UID/GID (when using the dockerFile property).
# See https://aka.ms/vscode-remote/containers/non-root-user for details.
ARG USERNAME=vscode
ARG USER_UID=1000
ARG USER_GID=$USER_UID
ARG DBCVER

# Configure apt
ENV DEBIAN_FRONTEND=noninteractive

# Mini Conda Start
ENV LANG=C.UTF-8 LC_ALL=C.UTF-8
ENV PATH /opt/conda/bin:$PATH
RUN echo ". /opt/conda/etc/profile.d/conda.sh" >> ~/.bashrc


RUN apt-get update --fix-missing && \
apt-get install -y wget bzip2 ca-certificates curl git && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

RUN wget --quiet https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-aarch64.sh -O ~/miniconda.sh && \
/bin/bash ~/miniconda.sh -b -p /opt/conda && \
rm ~/miniconda.sh && \
/opt/conda/bin/conda clean -tipsy && \
ln -s /opt/conda/etc/profile.d/conda.sh /etc/profile.d/conda.sh && \
echo ". /opt/conda/etc/profile.d/conda.sh" >> ~/.bashrc && \
echo "conda activate dbconnect" >> ~/.bashrc


ENV TINI_VERSION v0.16.1
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-arm64 /usr/bin/tini
RUN chmod +x /usr/bin/tini
ENTRYPOINT ["/usr/bin/tini", "--" ]
# CMD


COPY environments/environment${DBCVER}.yml .
RUN pip install --upgrade pip \
&& conda env create -f environment${DBCVER}.yml \
&& echo '{}' > /root/.databricks-connect

# VSCode DevContainers
RUN apt-get update \
&& apt-get -y install --no-install-recommends apt-utils dialog 2>&1 \
# Create a non-root user to use if preferred - see https://aka.ms/vscode-remote/containers/non-root-user.
&& groupadd --gid $USER_GID $USERNAME \
&& useradd -s /bin/bash --uid $USER_UID --gid $USER_GID -m $USERNAME \
# [Optional] Add sudo support for the non-root user
&& apt-get install -y sudo \
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME\
&& chmod 0440 /etc/sudoers.d/$USERNAME \
# Verify git, needed tools installed
&& apt-get -y install git iproute2 procps curl lsb-release

# Clean up
RUN apt-get autoremove -y \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*
ENV DEBIAN_FRONTEND=dialog

# Allow for a consistant java home location for settings - image is changing over time
RUN if [ ! -d "/docker-java-home" ]; then ln -s "${JAVA_HOME}" /docker-java-home; fi
9 changes: 2 additions & 7 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ stages:
jobs:
- template: .build/azure-pipelines-job-build.yml
parameters:
DBCVER: 9.1.13
DBCVERNODOTS: 9113
DBCVER: 9.1.14
DBCVERNODOTS: 9114

- template: .build/azure-pipelines-job-build.yml
parameters:
Expand All @@ -22,8 +22,3 @@ stages:
parameters:
DBCVER: 10.4.6
DBCVERNODOTS: 1046

- template: .build/azure-pipelines-job-build.yml
parameters:
DBCVER: 7.3.38
DBCVERNODOTS: 7338
8 changes: 8 additions & 0 deletions environments/environment9.1.14.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
name: dbconnect
channels:
- conda-forge
dependencies:
- python=3.8.12
- pip:
- databricks-connect==9.1.14
- six