FROM node:18 # Install system dependencies RUN useradd -o -u 1000 user # Set environment variables for the user ENV HOME=/home/user \ PATH=/usr/local/go/bin:$PATH # Install necessary packages and Go RUN apt-get update && apt-get install -y \ libnss3-dev \ ffmpeg \ git \ curl && \ curl -L "https://go.dev/dl/go1.23.6.linux-amd64.tar.gz" | tar -xz -C /usr/local && \ apt-get upgrade -y && \ rm -rf /var/lib/apt/lists/* # Ensure Go is installed correctly by setting the PATH properly for the user USER user # Set the working directory WORKDIR $HOME/app # Clone repository using GitHub token RUN --mount=type=secret,id=GH_TOKEN,mode=0444,required=true \ --mount=type=secret,id=REPO_URL,mode=0444,required=true \ git clone https://$(cat /run/secrets/GH_TOKEN)@$(cat /run/secrets/REPO_URL) . # Run go mod and get dependencies #RUN go mod init github.com/what-zit-tooyaa/moonton \ # && go get github.com/gin-gonic/gin \ # && go get github.com/google/go-github/v50/github \ # && go get golang.org/x/oauth2 \ # && go get github.com/parnurzeal/gorequest \ # && go get golang.org/x/net/proxy # Copy all files to the container COPY --chown=user . $HOME/app # Unduh dependensi Go RUN go mod download # Build the Go application RUN go build -o main . # Expose the port for the application EXPOSE 7860 # Run the application CMD ["./main"]