FROM node:22.1-bullseye

# Install git and other dependencies
RUN apt-get update && apt-get install -y bash build-essential git zsh \
    && rm -rf /var/lib/apt/lists/* 


# Install Oh My Zsh
RUN bash -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" && \
    sed -i 's/ZSH_THEME="robbyrussell"/ZSH_THEME="agnoster"/' ~/.zshrc

# Optional: Set zsh as the default shell for the root user
RUN chsh -s $(which zsh)

# Clone your Next.js application
ARG GIT_USERNAME
ARG GIT_PASSWORD
RUN git clone https://${GIT_USERNAME}:${GIT_PASSWORD}@git.workouttest.org/bossanyit/voxadata_app /app/voxadata_app

RUN npm install -g corepack

# Install and use yarn 4.x
RUN corepack enable && corepack prepare yarn@4.1.0 --activate

# Set the working directory to /app/voxadata_app
WORKDIR /app/voxadata_app

RUN ls -la

# Copies package.json, yarn.lock and other yarn files to Docker environment
#COPY package.json ./.yarn/releases/yarn-4.1.0.cjs ./

# Check Yarn configuration and install dependencies
RUN yarn config set cacheFolder .yarn/cache && yarn install

# Expose port 3000
EXPOSE 3000

# Run the app when the container launches
CMD ["tail", "-f", "/dev/null"]
