# Use the official image as a parent image.
FROM ubuntu:22.04

# Set the working directory.
USER root
WORKDIR /home/paper779/artifact

# Setup common tools.
RUN apt-get update -y
RUN apt-get install -y wget git make antlr4

RUN wget https://go.dev/dl/go1.25.2.linux-amd64.tar.gz
RUN tar -C /usr/local -xzf go1.25.2.linux-amd64.tar.gz
RUN rm go1.25.2.linux-amd64.tar.gz

ENV PATH="/usr/local/go/bin:/home/paper779/artifact/go/bin:${PATH}"
ENV GOPATH="/home/paper779/artifact/go"
ENV WG_HOME="${GOPATH}/src/github.com/rhu1/wg"

RUN mkdir -p ${WG_HOME}
RUN cd go/src/github.com/rhu1 && \
	git clone https://github.com/rhu1/wg.git && \
	cd wg && \
	git checkout popl26-artifact && \
	make generate-parser && \
	make install
RUN cd go/src/github.com/rhu1/wg && make test

