Skip to content

Commit

Permalink
upd docker config files
Browse files Browse the repository at this point in the history
  • Loading branch information
a-mhamdi committed Dec 8, 2024
1 parent 4e48079 commit 5deb320
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 78 deletions.
5 changes: 3 additions & 2 deletions Codes/Julia/Part-3/script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ DIRS=$(ls -la | grep '^d' | awk '{print $9}' | grep -v '^\.')

for dir in $DIRS; do
cd ${WORKING_DIR}$dir
rm Manifest.toml
sed '/^ImageShow/d' Project.toml > tmp && cat tmp > Project.toml && rm tmp
# sed -i '/^Image/d' Project.toml
sed '/^Image/d' Project.toml > tmp && cat tmp > Project.toml && rm tmp
# awk '!/^Image/' Project.toml > ${WORKING_DIR}/temp && mv ${WORKING_DIR}/temp ${WORKING_DIR}/Project.toml
julia -e 'import Pkg; Pkg.activate("."); Pkg.instantiate(); Pkg.precompile(); Pkg.resolve()'
julia -e 'import Pkg; Pkg.activate("."); Pkg.resolve(); Pkg.instantiate(); Pkg.precompile();'
done
43 changes: 16 additions & 27 deletions Docker/Dockerfile-1
Original file line number Diff line number Diff line change
@@ -1,38 +1,27 @@
FROM julia:1.10.0

LABEL author="A. Mhamdi <[email protected]>"
LABEL version="latest"

# Expose ports
EXPOSE 1234 2468
#= Set ENV variables =#
ENV JULIA_DEPOT_PATH /root/.julia

WORKDIR /workspace

# Set ENV variables
ENV USERNAME mhamdi
ENV USER_HOME_DIR /home/${USERNAME}
ENV JULIA_DEPOT_PATH ${USER_HOME_DIR}/.julia
ENV JL ${JULIA_DEPOT_PATH}/conda/3/bin/jupyter\ lab
ARG WORKING_DIR="${USER_HOME_DIR}/work/"

# Add user and set ownership
RUN useradd -ms /bin/bash -p $(echo ${USERNAME} | openssl passwd -1 -stdin) ${USERNAME}

# Change user & working directory
USER ${USERNAME}
WORKDIR "${USER_HOME_DIR}"
# Copy needed files and datasets
RUN mkdir -p "${WORKING_DIR}"
# Change working directory
WORKDIR "${WORKING_DIR}"

# Copy datasets
#= Copy datasets =#
COPY ./Codes/Julia/Datasets ./datasets/

# Copy TOML files (deps, ver, pkg, UUID)
#= Copy TOML files (deps, ver, pkg, UUID) =#
COPY ./Codes/Julia/Part-1/Project.toml ./
# COPY ./Codes/Julia/Manifest.toml ./

# Activate environment and add IJulia kernel, Pluto and JupyterLab IDE
RUN julia -e 'import Pkg; Pkg.activate("."); Pkg.instantiate(); Pkg.precompile()'
#= Activate environment and add IJulia kernel, Pluto and JupyterLab IDE =#
RUN julia -e 'import Pkg; Pkg.activate("."); Pkg.resolve(); Pkg.instantiate(); Pkg.precompile()'
RUN julia -e 'import Pkg; Pkg.add(["Conda", "IJulia", "Pluto"]); Pkg.precompile()'
RUN julia -e 'import Conda; Conda.add("JupyterLab")'

# Default command
CMD julia
#= Expose ports =#
EXPOSE 1234 2468

#= Default command =#
CMD [ "julia" ]

43 changes: 16 additions & 27 deletions Docker/Dockerfile-2
Original file line number Diff line number Diff line change
@@ -1,38 +1,27 @@
FROM julia:1.10.0

LABEL author="A. Mhamdi <[email protected]>"
LABEL version="latest"

# Expose ports
EXPOSE 1234 2468
#= Set ENV variables =#
ENV JULIA_DEPOT_PATH /roo/.julia

WORKDIR /workspace

# Set ENV variables
ENV USERNAME mhamdi
ENV USER_HOME_DIR /home/${USERNAME}
ENV JULIA_DEPOT_PATH ${USER_HOME_DIR}/.julia
ENV JL ${JULIA_DEPOT_PATH}/conda/3/bin/jupyter\ lab
ARG WORKING_DIR="${USER_HOME_DIR}/work/"

# Add user and set ownership
RUN useradd -ms /bin/bash -p $(echo ${USERNAME} | openssl passwd -1 -stdin) ${USERNAME}

# Change user & working directory
USER ${USERNAME}
WORKDIR "${USER_HOME_DIR}"
# Copy needed files and datasets
RUN mkdir -p "${WORKING_DIR}"
# Change working directory
WORKDIR "${WORKING_DIR}"

# Copy datasets
#= Copy datasets =#
COPY ./Codes/Julia/Datasets ./datasets/

# Copy TOML files (deps, ver, pkg, UUID)
#= Copy TOML files (deps, ver, pkg, UUID) =#
COPY ./Codes/Julia/Part-2/Project.toml ./
# COPY ./Codes/Julia/Manifest.toml ./

# Activate environment and add IJulia kernel, Pluto and JupyterLab IDE
RUN julia -e 'import Pkg; Pkg.activate("."); Pkg.instantiate(); Pkg.precompile()'
#= Activate environment and add IJulia kernel, Pluto and JupyterLab IDE =#
RUN julia -e 'import Pkg; Pkg.activate("."); Pkg.resolve(); Pkg.instantiate(); Pkg.precompile()'
RUN julia -e 'import Pkg; Pkg.add(["Conda", "IJulia", "Pluto"]); Pkg.precompile()'
RUN julia -e 'import Conda; Conda.add("JupyterLab")'

# Default command
CMD julia
#= Expose ports =#
EXPOSE 1234 2468

#= Default command =#
CMD [ "julia" ]

25 changes: 8 additions & 17 deletions Docker/Dockerfile-3
Original file line number Diff line number Diff line change
@@ -1,24 +1,15 @@
FROM julia:1.11.0

LABEL author="A. Mhamdi <[email protected]>"
LABEL version="latest"

#= Set ENV variables =#
ENV USERNAME=mhamdi
ENV USER_HOME_DIR=/home/${USERNAME}
ENV JULIA_DEPOT_PATH=${USER_HOME_DIR}/.julia
ENV JL=${JULIA_DEPOT_PATH}/conda/3/bin/jupyter\ lab
ARG WORKING_DIR="${USER_HOME_DIR}/work/"

#= Add user and set ownership =#
RUN useradd -ms /bin/bash -p $(echo ${USERNAME} | openssl passwd -1 -stdin) ${USERNAME}

#= Change user & working directory =#
# USER ${USERNAME}
WORKDIR "${USER_HOME_DIR}"
RUN mkdir -p "${WORKING_DIR}"
WORKDIR "${WORKING_DIR}"

# Copy TOML files (deps, ver, pkg, UUID)
COPY ../Codes/Julia/Part-3/. ./
ENV JULIA_DEPOT_PATH=/root/.julia

WORKDIR /workspace

#= Copy TOML files (deps, ver, pkg, UUID) =#
COPY ./Codes/Julia/Part-3/. ./
RUN sh -x script.sh

#= Expose ports =#
Expand Down
8 changes: 3 additions & 5 deletions Docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
version: "3.9"

services:
jupyter:
image: jlai:local
ports:
- "2468:2468"
command: /home/mhamdi/.julia/conda/3/x86_64/bin/jupyter lab --NotebookApp.token='' --ip 0.0.0.0 --port 2468 --allow-root --no-browser
command: /root/.julia/conda/3/x86_64/bin/jupyter lab --NotebookApp.token='' --ip 0.0.0.0 --port 2468 --allow-root --no-browser
volumes:
- /home/mhamdi/.julia/scratchspaces/:/home/mhamdi/.julia/scratchspaces/
- $HOME/.julia/scratchspaces/:/root/.julia/scratchspaces/
pluto:
image: jlai:local
ports:
- "1234:1234"
command: julia -e "import Pluto; Pluto.run(host=\"0.0.0.0\", port=1234, launch_browser=false, require_secret_for_open_links=false, require_secret_for_access=false)"
volumes:
- /home/mhamdi/.julia/scratchspaces/:/home/mhamdi/.julia/scratchspaces/
- $HOME/.julia/scratchspaces/:/root/.julia/scratchspaces/

0 comments on commit 5deb320

Please sign in to comment.