Coder Social home page Coder Social logo

Dockerfile about arch-mojo HOT 4 CLOSED

sharktheone avatar sharktheone commented on August 13, 2024
Dockerfile

from arch-mojo.

Comments (4)

Sharktheone avatar Sharktheone commented on August 13, 2024 1

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?

from arch-mojo.

Sharktheone avatar Sharktheone commented on August 13, 2024

Have you tried the Dockerfile from modular? I haven't tried it, but it should work on arch since it is docker

from arch-mojo.

hajsf avatar hajsf commented on August 13, 2024

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

from arch-mojo.

hajsf avatar hajsf commented on August 13, 2024

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

from arch-mojo.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.