# Stage 1: Build stage with git
FROM ubuntu:jammy AS GITCOPY

WORKDIR /roysathome

RUN apt-get update && apt-get install -y git

RUN git clone https://git.roysathome.net/joseph/roysathome.net.git .

# Stage 2: Final image with Ruby
FROM ruby:3.2.2

# Copy files from the first stage
COPY --from=GITCOPY /roysathome/auth /app

WORKDIR /app

# Gemfile and Gemfile.lock are already in /usr/src/app/roysathome/auth due to the previous COPY command

RUN bundle install

CMD ["./auth.rb"]
