Skip to content

Commit

Permalink
feat: add docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
giancarlopro committed Sep 10, 2023
1 parent a125754 commit d3b5f6c
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
16 changes: 16 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM ubuntu:latest

WORKDIR /app
COPY . /app

RUN apt update && \
apt install -y gcc git make curl tar zip cmake pkg-config build-essential

RUN git clone https://github.com/microsoft/vcpkg.git /vcpkg && \
/vcpkg/bootstrap-vcpkg.sh && \
/vcpkg/vcpkg integrate install && \
/vcpkg/vcpkg install json-c

RUN make CFLAGS="-I/vcpkg/installed/x64-linux/include" LDFLAGS="-L/vcpkg/installed/x64-linux/lib"

CMD [ "/bin/bash", "-c", "build/interpreter", "/var/rinha/source.rinha.json" ]
9 changes: 7 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
ifndef CFLAGS
CFLAGS=-I/vcpkg/installed/x64-linux/include
LDFLAGS=-L/vcpkg/installed/x64-linux/lib
endif

interpreter: src/stack.c src/error.c src/interpreter.c src/alloc.c src/main.c
gcc -o build/interpreter -ljson-c src/stack.c src/error.c src/interpreter.c src/alloc.c src/main.c
gcc $(CFLAGS) $(LDFLAGS) -o build/interpreter src/stack.c src/error.c src/interpreter.c src/alloc.c src/main.c -ljson-c

test: src/stack.c src/error.c src/interpreter.c src/alloc.c tests/test_interpreter.c
gcc -g -o build/test_interpreter -ljson-c src/stack.c src/error.c src/interpreter.c src/alloc.c tests/test_interpreter.c
gcc $(CFLAGS) $(LDFLAGS) -g -o build/test_interpreter src/stack.c src/error.c src/interpreter.c src/alloc.c tests/test_interpreter.c -ljson-c

defaul: interpreter

0 comments on commit d3b5f6c

Please sign in to comment.