Closed hajsf closed 9 months ago
Have you tried the Dockerfile from modular? I haven't tried it, but it should work on arch since it is docker
I have sone issues with, but I was to build my own docker using ubuntu as below: .env file:
MODULAR_AUTH_KEY=mut_a2ffxxxxxxxxxxxxxxxxxx8f
auth_script.sh file:
#!/bin/bash
# Read the MODULAR_AUTH_KEY from the .env file and execute modular auth
export $(cat .env | xargs) && \
modular auth $MODULAR_AUTH_KEY
Dockerfile.mojosdk:
# Use the latest Ubuntu base image
FROM ubuntu:latest
# Set environment variable to avoid interactive prompts during package installation
ENV DEBIAN_FRONTEND=noninteractive
# Set working directory inside the container
WORKDIR /app
# Copy necessary files into the container
COPY auth_script.sh .
COPY .env .
# Update package lists and install required packages
RUN apt-get update && \
apt-get install -y \
software-properties-common \
gnupg \
git \
curl \
wget \
&& apt-get clean && rm -rf /var/lib/apt/lists/* \
&& set -eux; \
# Add Python 3.10 repository and install dependencies
add-apt-repository ppa:deadsnakes/ppa -y \
&& keyring_location=/usr/share/keyrings/modular-installer-archive-keyring.gpg \
&& curl -1sLf 'https://dl.modular.com/bBNWiLZX5igwHXeu/installer/gpg.0E4925737A3895AD.key' | gpg --dearmor >> ${keyring_location} \
&& curl -1sLf 'https://dl.modular.com/bBNWiLZX5igwHXeu/installer/config.deb.txt?distro=debian&codename=wheezy' > /etc/apt/sources.list.d/modular-installer.list \
&& apt-get update \
&& apt install -y python3.10 python3.10-venv \
&& apt-get install -y modular \
&& apt-get clean && rm -rf /var/lib/apt/lists/* \
# Set environment variables for Mojo installation
&& echo 'export MODULAR_HOME="/root/.modular"' >> ~/.bashrc \
&& echo 'export PATH="/root/.modular/pkg/packages.modular.com_mojo/bin:$PATH"' >> ~/.bashrc \
&& /bin/bash -c "source ~/.bashrc" \
# Clean up and set permissions
&& modular clean \
&& chmod +x auth_script.sh \
&& ./auth_script.sh \
&& modular install mojo \
&& pip install --upgrade pip
# Clean up unnecessary packages and files
RUN apt-get remove -y \
software-properties-common \
gnupg \
&& apt-get autoremove -y \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
&& apt-get purge -y --auto-remove
# Remove the copied script and environment file
RUN rm auth_script.sh .env
# Expose port 80 for external access
EXPOSE 80
# Set default entrypoint and command for the container
ENTRYPOINT ["tail"]
CMD ["-f", "/dev/null"]
Build the container:
docker build -t mojo-sdk:r0.6 -f Dockerfile.mojosdk --no-cache .
Create a volume for the projects:
docker volume create mojoProjects
Create and run the develi=opment container, and map it with the docker volme
docker run -d --publish 3000:80 --name mojo-dev --mount source=mojoProjects,target=/app mojo-sdk:r0.6
The generated image size is 1256 MB, and it is working very well.
I'm just excited if docker image of the same can be built using Archlinux docker image as a base. Thanks
I guess, alpine, debian (or ubuntu) fit best for a container base image.
From what I'm reading, your issue is solved, so I can close this?
Thanks a lot, yes you can close it, I just created a repository of my working if any one here is interested. https://github.com/hajsf/mojo-docker/tree/main
I'm trying to build a docker file for mojo lang, it was done smoothly using Ubuntu vase image as:
And I tried to do the same based on archlinux base image, but I struggled in that, I updated the
install.py
file to be:And wrote the Dockerfile as:
But i got the below at the last stage:
Can you help in this please. thanks