Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create docker images #194

Merged
merged 9 commits into from
May 27, 2024
Merged
Show file tree
Hide file tree
Changes from 8 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
16 changes: 9 additions & 7 deletions .docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
FROM mariadb:latest
LABEL maintainer="DRKZ-CLINT"
LABEL repository="https://gitlab.dkrz.de/freva/evaluation_system"
ARG VERSION
LABEL org.opencontainers.image.authors="DRKZ-CLINT"
LABEL org.opencontainers.image.source="https://github.com/FREVA-CLINT/freva"
LABEL org.opencontainers.image.version="$VERSION"
ARG binder="true"
## Set all environment variables
ENV SOLR_HOME=/opt/evaluation_system/.solr \
Expand Down Expand Up @@ -43,7 +45,7 @@ RUN set -x && \
mkdir -p /etc/jupyter /usr/freva_output && \
chmod -R 2777 /usr/freva_output &&\
mkdir -p /mnt/freva_plugins/dummy/.git &&\
mv /tmp/evaluation_system/.git/config /mnt/freva_plugins/dummy/.git/ &&\
mv /tmp/evaluation_system/.docker/git_config /mnt/freva_plugins/dummy/.git/ &&\
cp /tmp/evaluation_system/src/evaluation_system/tests/mocks/dummy.py /mnt/freva_plugins/dummy &&\
cp /mnt/freva_plugins/animator/.git/config . &&\
rm -fr /mnt/freva_plugins/animator/.git/* &&\
Expand Down Expand Up @@ -90,12 +92,12 @@ RUN set -x && \
echo "set -e" > /tmp/mysql_init &&\
echo "mariadb-install-db" >> /tmp/mysql_init &&\
echo "nohup mariadbd --skip-grant-tables &" >> /tmp/mysql_init &&\
echo "mysqladmin --socket=${MYSQL_HOME}/mysql.${MYSQL_PORT}.sock --wait=5 ping || exit 1" >> /tmp/mysql_init &&\
echo "mariadb-admin --socket=${MYSQL_HOME}/mysql.${MYSQL_PORT}.sock --wait=5 ping || exit 1" >> /tmp/mysql_init &&\
bash /tmp/mysql_init && rm /tmp/mysql_init &&\
cat ${MYSQL_LOGS_DIR}/mysql-${MYSQL_PORT}-console.err &&\
mysql -u root -h 127.0.0.1 < /tmp/set_root_pw &&\
mysql -u root -h 127.0.0.1 -pT3st < /docker-entrypoint-initdb.d/create_user.sql &&\
mysql -u root -pT3st -h 127.0.0.1 -D freva < /docker-entrypoint-initdb.d/create_tables.sql &&\
mariadb -u root -h 127.0.0.1 < /tmp/set_root_pw &&\
mariadb -u root -h 127.0.0.1 -pT3st < /docker-entrypoint-initdb.d/create_user.sql &&\
mariadb -u root -pT3st -h 127.0.0.1 -D freva < /docker-entrypoint-initdb.d/create_tables.sql &&\
chown -R freva:freva ${EVAL_HOME} ${MYSQL_HOME} ${SOLR_HOME} && \
chmod -R 775 ${MYSQL_HOME} ${SOLR_HOME} && \
rm -fr /tmp/set_root_pw /tmp/evaluation_system
Expand Down
15 changes: 15 additions & 0 deletions .docker/git_config
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[submodule]
active = .
[remote "origin"]
url = [email protected]:FREVA-CLINT/freva.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "main"]
remote = origin
merge = refs/heads/main
[submodule "compose/config"]
url = https://github.com/FREVA-CLINT/freva-service-config.git
116 changes: 116 additions & 0 deletions .github/workflows/build_containers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
name: Creating container images
run-name: Creating container images 🧉

# Set the access for individual scopes, or use permissions: write-all
permissions:
pull-requests: write
contents: write
packages: write

on:
push:
pull_request:
types: [closed]
branches:
- main
workflow_dispatch:


jobs:

freva-dev-image-linux:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
-
name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
-
name: Set up Python 3.X
uses: actions/setup-python@v4
with:
python-version: "3.X"
-
name: Get tag
id: repository
run: |
echo "tag=$(python src/evaluation_system/__init__.py)" >> $GITHUB_OUTPUT
-
name: Set up QEMU
uses: docker/setup-qemu-action@v2

-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Build and push freva-dev image
uses: docker/build-push-action@v4
with:
push: ${{ github.event_name == 'pull_request' && github.event.pull_request.merged == true && github.ref == 'refs/heads/main' }}
file: .docker/Dockerfile
build-args: |
VERSION=${{steps.repository.outputs.tag}}
binder=false
tags: |
ghcr.io/freva-clint/freva-dev:${{ steps.repository.outputs.tag }}
ghcr.io/freva-clint/freva-dev:latest
platforms: linux/amd64

freva-image-linux:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
-
name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
-
name: Set up Python 3.X
uses: actions/setup-python@v4
with:
python-version: "3.X"
-
name: Get tag
id: repository
run: |
echo "tag=$(python src/evaluation_system/__init__.py)" >> $GITHUB_OUTPUT
-
name: Set up QEMU
uses: docker/setup-qemu-action@v1

-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

-
name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Build and push freva image
uses: docker/build-push-action@v4
with:
platforms: linux/amd64
file: .docker/Dockerfile
push: ${{ github.event_name == 'pull_request' && github.event.pull_request.merged == true && github.ref == 'refs/heads/main' }}
build-args: VERSION=${{steps.repository.outputs.tag}}
tags: |
ghcr.io/freva-clint/freva:${{ steps.repository.outputs.tag }}
ghcr.io/freva-clint/freva:latest
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM antarcticrainforest/freva
FROM ghcr.io/freva-clint/freva:latest

ARG NB_USER="nb_user"
ARG NB_UID="1000"
Expand Down
2 changes: 1 addition & 1 deletion compose/config
3 changes: 3 additions & 0 deletions src/evaluation_system/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,6 @@


__version__ = "2406.0.0"

if __name__ == "__main__":
print(__version__)
Loading