Skip to content

Commit

Permalink
Merge pull request #29 from term-world/api-container
Browse files Browse the repository at this point in the history
added documentation and experimented with ip and port variables
  • Loading branch information
dluman committed May 23, 2024
2 parents 67d20c8 + e01eb4f commit fdcd978
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions dockerfiles/topia/api-container/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
# Use the official Ubuntu image as the base image
FROM ubuntu

# Set the DEBIAN_FRONTEND environment variable to noninteractive to disable interactive prompts during package installation
ENV DEBIAN_FRONTEND=noninteractive

# Set the ip and port environment variables
ENV ip=127.0.0.1
ENV port=8000

# Set the system timezone to America/New_York
RUN echo "America/New_York" > /etc/timezone

# Update the package lists for upgrades and new package installations, then install the listed packages
RUN apt-get update && apt-get install -y \
jq \
git \
Expand All @@ -20,6 +28,7 @@ RUN apt-get update && apt-get install -y \
libcairo2-dev \
python-is-python3

# Install the listed Python packages using pip
RUN python -m pip install \
rich \
typer \
Expand All @@ -33,34 +42,45 @@ RUN python -m pip install \
gatorgrader \
python-dotenv --break-system-packages

# Create a new cli directory, change into it, initialize a new repo, and add a new remote named "origin" with the URL of the "api-services" repository
RUN mkdir cli
RUN cd cli
RUN git init
RUN git remote add -f origin https://github.com/term-world/api-services.git

# Enable the sparse checkout feature in Git, which allows you to checkout only a part of a repository
RUN git config core.sparseCheckout true

# Add "cli/" to the sparse-checkout file, pull from the main branch, change into cli and install the python packages
RUN echo "cli/" >> .git/info/sparse-checkout
RUN git pull origin main
RUN ls
RUN cd cli && python -m pip install . --break-system-packages

# Define an argument for the GitHub CDN URL (world-container)
ARG GITHUB_CDN=https://raw.githubusercontent.com/term-world/world-container/main

# Download a script from the GitHub CDN and append it to the bashrc file, download and execute a script from the GitHub CDN
RUN curl -fsSL $GITHUB_CDN/scripts/direvents.sh | cat >> /etc/bash.bashrc
RUN curl -fsSL $GITHUB_CDN/scripts/gginstall.sh | sh

# Download the latest release of the "term-world-theme" and "term-launcher" repositories
RUN curl -fsSL https://api.github.com/repos/term-world/term-world-theme/releases/latest | wget $(jq -r ".assets[].browser_download_url")
RUN curl -fsSl https://api.github.com/repos/term-world/term-launcher/releases/latest | wget $(jq -r ".assets[].browser_download_url")

# Download a VS Code extension and the "motd" file from the GitHub CDN
RUN wget $GITHUB_CDN/extensions/bierner.markdown-checkbox-0.4.0.vsix
RUN wget $GITHUB_CDN/scripts/motd

# Copy the "motd" file to the "/etc/motd" path
RUN cp motd /etc/motd

# Append a command to display the contents of the "motd" file to the bashrc file
RUN echo "cat /etc/motd" >> /etc/bash.bashrc

# Add the "entrypoint.sh" file from the Docker build context to the image, and make the "entrypoint.sh" file executable
ADD entrypoint.sh entrypoint.sh
RUN chmod +x entrypoint.sh

# Set the "entrypoint.sh" script as the entrypoint of the container (this script will be executed when a container is run from the image)
ENTRYPOINT /entrypoint.sh

0 comments on commit fdcd978

Please sign in to comment.