Update.
This commit is contained in:
parent
8d0ed4f185
commit
c64c92e1cc
37
Dockerfile
Normal file
37
Dockerfile
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
# Use an official Ubuntu as a base image
|
||||||
|
FROM ubuntu:latest
|
||||||
|
|
||||||
|
# Set environment variables to avoid interactive prompts during package installation
|
||||||
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
|
# Update the package list and install required packages
|
||||||
|
RUN apt-get update -y && \
|
||||||
|
apt-get install -y \
|
||||||
|
gcc \
|
||||||
|
make \
|
||||||
|
libreadline-dev \
|
||||||
|
libncurses5-dev \
|
||||||
|
libcurl4-openssl-dev \
|
||||||
|
libssl-dev \
|
||||||
|
libjson-c-dev \
|
||||||
|
libsqlite3-dev \
|
||||||
|
python3-dev \
|
||||||
|
&& apt-get clean \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
RUN mkdir /r
|
||||||
|
# Set the working directory
|
||||||
|
WORKDIR /r
|
||||||
|
|
||||||
|
# Copy the source files into the container
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
# Build the application
|
||||||
|
RUN make build
|
||||||
|
|
||||||
|
RUN cp r /usr/local/bin/r
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Command to run the application (optional, can be overridden)
|
||||||
|
CMD ["r", "--verbose"]
|
28
Makefile
28
Makefile
@ -1,28 +1,35 @@
|
|||||||
all: build build_rd build_free build_rpylib run
|
all: build build_rd build_free build_rpylib run build_mingw
|
||||||
|
|
||||||
# Variables for compiler and flags
|
# Variables for compiler and flags
|
||||||
CC = gcc
|
CC = gcc
|
||||||
CFLAGS = -Ofast -Werror -Wall -lreadline -lncurses -lcurl -lssl -lcrypto -ljson-c -lm -lsqlite3
|
CFLAGS = -Ofast -Werror -Wall -lreadline -lncurses -lcurl -lssl -lcrypto -ljson-c -lm -lsqlite3
|
||||||
|
|
||||||
|
# MinGW Variables
|
||||||
|
MINGW_CC = x86_64-w64-mingw32-gcc # Change to x86_64-w64-mingw32-gcc for 64-bit
|
||||||
|
MINGW_CFLAGS = -Ofast -Werror -Wall -lreadline -lcurl -lssl -lcrypto -ljson-c -lm -lglob
|
||||||
|
|
||||||
# Targets
|
# Targets
|
||||||
build:
|
build:
|
||||||
$(CC) main.c $(CFLAGS) -o r
|
$(CC) main.c $(CFLAGS) -o r
|
||||||
publish r
|
-@publish r
|
||||||
|
|
||||||
build_free:
|
build_free:
|
||||||
$(CC) -DOLLAMA main.c $(CFLAGS) -o rf
|
$(CC) -DOLLAMA main.c $(CFLAGS) -o rf
|
||||||
publish rf
|
@publish rf
|
||||||
|
|
||||||
build_rd:
|
build_rd:
|
||||||
$(CC) -DRD main.c $(CFLAGS) -o rd
|
$(CC) -DRD main.c $(CFLAGS) -o rd
|
||||||
publish rd
|
publish rd
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
build_rpylib:
|
build_rpylib:
|
||||||
$(CC) -shared -o rpylib.so -fPIC rpylib.c -lpython3.12 `python3-config --includes` -I/usr/include/CL -ljson-c -lcurl -lsqlite3
|
$(CC) -shared -o rpylib.so -fPIC rpylib.c -lpython3.12 `python3-config --includes` -I/usr/include/CL -ljson-c -lcurl -lsqlite3
|
||||||
publish rpylib.so
|
publish rpylib.so
|
||||||
|
|
||||||
|
# New MinGW build target
|
||||||
|
build_mingw:
|
||||||
|
$(MINGW_CC) main.c $(MINGW_CFLAGS) -o r.exe
|
||||||
|
publish r.exe
|
||||||
|
|
||||||
run:
|
run:
|
||||||
./r --verbose
|
./r --verbose
|
||||||
|
|
||||||
@ -31,3 +38,14 @@ run_free:
|
|||||||
|
|
||||||
run_rd:
|
run_rd:
|
||||||
./rd --verbose
|
./rd --verbose
|
||||||
|
|
||||||
|
run_mingw:
|
||||||
|
./r.exe --verbose
|
||||||
|
|
||||||
|
docker: docker_make docker_run
|
||||||
|
|
||||||
|
docker_make:
|
||||||
|
docker build -t r .
|
||||||
|
|
||||||
|
docker_run:
|
||||||
|
docker run -v .:/app --rm -it r
|
||||||
|
10
compose.yml
Normal file
10
compose.yml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
services:
|
||||||
|
shell:
|
||||||
|
build: .
|
||||||
|
command: sh
|
||||||
|
tty: true
|
||||||
|
stdin_open: true
|
||||||
|
working_dir: /home
|
||||||
|
volumes:
|
||||||
|
- ./:/home
|
||||||
|
|
Loading…
Reference in New Issue
Block a user