From a121efbaf1302825813ea5b41c1e1419c68034e9 Mon Sep 17 00:00:00 2001 From: Co Quach Date: Mon, 4 Dec 2023 16:59:54 -0600 Subject: [PATCH 1/2] update dockerfile and docker actions version in ci.yml --- .github/workflows/CI.yaml | 10 +++++----- Dockerfile | 36 +++++++++++++++++++++++++++--------- 2 files changed, 32 insertions(+), 14 deletions(-) diff --git a/.github/workflows/CI.yaml b/.github/workflows/CI.yaml index bdd0df47d..e500187f3 100644 --- a/.github/workflows/CI.yaml +++ b/.github/workflows/CI.yaml @@ -66,7 +66,7 @@ jobs: uses: mamba-org/setup-micromamba@v1 with: environment-file: environment-dev.yml - python-version: python="3.10" + create-args: python="3.10" - name: Clone mBuild and Foyer and forcefield-utilities run: | @@ -95,14 +95,14 @@ jobs: runs-on: ubuntu-latest needs: test name: Build Docker Image - if: ${{ false }} + if: github.event_name != 'pull_request' steps: - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 + uses: docker/setup-buildx-action@v3 - name: Login to DockerHub - uses: docker/login-action@v1 + uses: docker/login-action@v3 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_PASSWORD }} @@ -122,7 +122,7 @@ jobs: echo Docker Image tags: ${DOCKER_TAGS} - name: Build and Push - uses: docker/build-push-action@v2 + uses: docker/build-push-action@v5 with: push: true tags: ${{ env.DOCKER_TAGS }} diff --git a/Dockerfile b/Dockerfile index 1bc453c91..c76cea6bc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,5 @@ -FROM mambaorg/micromamba:1.4.3 +ARG PY_VERSION=3.10 +FROM continuumio/miniconda3:4.10.3-alpine AS builder EXPOSE 8888 @@ -13,17 +14,34 @@ ADD . /gmso WORKDIR /gmso -RUN apt-get update && apt-get install -y git +# Create a group and user +RUN addgroup -S anaconda && adduser -S anaconda -G anaconda + +RUN apk update && apk add libarchive &&\ + conda update conda -yq && \ + conda config --set always_yes yes --set changeps1 no && \ + . /opt/conda/etc/profile.d/conda.sh && \ + sed -i -E "s/python.*$/python="$(PY_VERSION)"/" environment-dev.yml && \ + conda install -c conda-forge mamba && \ + mamba env create --file environment-dev.yml && \ + conda activate gmso-dev && \ + mamba install -c conda-forge jupyter python="$PY_VERSION" && \ + python setup.py install && \ + echo "source activate gmso-dev" >> \ + /home/anaconda/.profile && \ + conda clean -afy && \ + mkdir -p /home/anaconda/data && \ + chown -R anaconda:anaconda /gmso && \ + chown -R anaconda:anaconda /opt && \ + chown -R anaconda:anaconda /home/anaconda -RUN micromamba create --file environment-dev.yml && \ - micromamba clean -afy -ARG MAMBA_DOCKERFILE_ACTIVATE=1 # (otherwise python will not be found) +WORKDIR /home/anaconda -RUN micromamba install -c conda-forge nomkl jupyter python="3.10" && \ - python setup.py install && \ - echo "source activate gmso-dev" >> /home/.bashrc && \ - mkdir -p /home/data +COPY devtools/docker-entrypoint.sh /entrypoint.sh + +RUN chmod a+x /entrypoint.sh +USER anaconda ENTRYPOINT ["/entrypoint.sh"] CMD ["jupyter"] From 2ed3ddebcc1fa1f3b4976a2155a8b02f93c3ca37 Mon Sep 17 00:00:00 2001 From: Co Quach <43968221+daico007@users.noreply.github.com> Date: Wed, 6 Dec 2023 08:36:06 -0600 Subject: [PATCH 2/2] Update .github/workflows/CI.yaml --- .github/workflows/CI.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yaml b/.github/workflows/CI.yaml index e500187f3..ba6063968 100644 --- a/.github/workflows/CI.yaml +++ b/.github/workflows/CI.yaml @@ -66,7 +66,7 @@ jobs: uses: mamba-org/setup-micromamba@v1 with: environment-file: environment-dev.yml - create-args: python="3.10" + create-args: python=3.10 - name: Clone mBuild and Foyer and forcefield-utilities run: |