File size: 1,391 Bytes
1de5b6e 18e8e9a 0e21b74 0f03e2f 0e21b74 0f03e2f b1efc6d 0f03e2f b1efc6d 18e8e9a 1de5b6e dda4626 18e8e9a 0e21b74 18e8e9a 0e21b74 18e8e9a 0e21b74 aeb832f 18e8e9a 0e21b74 18e8e9a aeb832f 0e21b74 18e8e9a 0e21b74 18e8e9a 0e21b74 b1efc6d | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | 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"] |