Rewrite bot into Python
This commit is contained in:
46
Dockerfile
46
Dockerfile
@ -1,44 +1,10 @@
|
||||
FROM golang:alpine
|
||||
FROM python:3.12-slim
|
||||
|
||||
# Git is required for go mod download
|
||||
RUN apk update && apk add --no-cache git ca-certificates
|
||||
ENV PYTHONUNBUFFERED=1
|
||||
ENV PYTHONDONTWRITEBYTECODE=1
|
||||
|
||||
ENV USER=anewdawn
|
||||
ENV UID=10001
|
||||
|
||||
# Create anewdawn user
|
||||
RUN adduser \
|
||||
--disabled-password \
|
||||
--gecos "" \
|
||||
--home "/nonexistent" \
|
||||
--shell "/sbin/nologin" \
|
||||
--no-create-home \
|
||||
--uid "${UID}" \
|
||||
"${USER}"
|
||||
|
||||
# Set the working directory
|
||||
WORKDIR /usr/src/app
|
||||
|
||||
# Copy the current directory contents into the container at /usr/src/app
|
||||
WORKDIR /app
|
||||
COPY . .
|
||||
RUN pip install .
|
||||
|
||||
# Download dependencies
|
||||
RUN go get -d -v
|
||||
|
||||
# Build the binary
|
||||
RUN GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" -o /usr/local/bin/anewdawn
|
||||
|
||||
FROM scratch
|
||||
|
||||
COPY --from=0 /etc/passwd /etc/passwd
|
||||
COPY --from=0 /etc/group /etc/group
|
||||
COPY --from=0 /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
|
||||
|
||||
# Copy the binary from the first stage
|
||||
COPY --from=0 /usr/local/bin/anewdawn /usr/local/bin/anewdawn
|
||||
|
||||
# Use an unprivileged user.
|
||||
USER anewdawn:anewdawn
|
||||
|
||||
# Command to run the executable
|
||||
ENTRYPOINT ["/usr/local/bin/anewdawn"]
|
||||
CMD ["python", "main.py"]
|
||||
|
Reference in New Issue
Block a user