File size: 1,827 Bytes
3a8a2c6 a5bd717 7a48b92 3a8a2c6 7a48b92 3a8a2c6 da89c20 6bd3e61 0dd86c5 6bd3e61 32bcd61 92e3740 98626ac 92e3740 32bcd61 6bd3e61 94d97d4 856bbc3 da89c20 09be4db 32bcd61 920c760 e5ecb9b 1c59e86 31e1b70 a5bd717 32bcd61 e5ecb9b 32bcd61 3126291 |
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 53 54 55 56 57 58 59 60 61 62 63 |
# Use an official Ubuntu as a parent image
FROM ubuntu:20.04
# Set environment variables to avoid interactive prompts during package installation
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Etc/UTC
# Install required packages
RUN apt-get update && apt-get install -y \
git \
curl \
tzdata \
&& rm -rf /var/lib/apt/lists/*
# Install Golang
RUN curl -LO https://golang.org/dl/go1.18.10.linux-amd64.tar.gz && \
tar -C /usr/local -xzf go1.18.10.linux-amd64.tar.gz && \
rm go1.18.10.linux-amd64.tar.gz
# Set up Go environment
ENV GOPATH=/go
ENV PATH=$PATH:/usr/local/go/bin:$GOPATH/bin
# Set the working directory inside the container
WORKDIR /app
# Clone the Transfer.sh repository
RUN git clone https://github.com/dutchcoders/transfer.sh.git .
# Move to the correct directory
WORKDIR /app
# Install any needed dependencies specified in the go.mod and go.sum files
RUN /usr/local/go/bin/go mod tidy
# Build the Go app for the correct architecture
RUN GOOS=linux GOARCH=amd64 /usr/local/go/bin/go build -o transfersh ./cmd
# Set executable permissions for the binary
RUN chmod +x transfersh
# Create a Downloads directory for storage
RUN mkdir -p /app/Downloads && chmod -R 777 /app/Downloads
# Create a temp directory
RUN mkdir -p /app/temp && chmod -R 777 /app/temp
# Expose the port the app runs on
EXPOSE 8080
# Environment variables to avoid common issues
ENV PYTHONUNBUFFERED=1 \
GRADIO_ALLOW_FLAGGING=never \
GRADIO_NUM_PORTS=1 \
GRADIO_SERVER_NAME=0.0.0.0 \
SYSTEM=spaces
# Run the app
CMD ["./transfersh", "--provider", "local", "--basedir", "/app/Downloads", "--temp-path", "/app/temp"]
# Health check to ensure the container is running correctly
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD curl -f http://localhost:8080/ || exit 1 |