Skip to content

Commit

Permalink
docker: add Dockerfile and docker-compose
Browse files Browse the repository at this point in the history
  • Loading branch information
tbmc committed May 28, 2024
1 parent f3eaf13 commit 6dd91af
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 2 deletions.
7 changes: 7 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
svelte/node_modules/*
websocketServer/node_modules/*
.idea/*
svelte/.idea/*
websocketServer/.idea/*

target/*
14 changes: 12 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,19 @@ COPY . .

RUN cargo install --path .

FROM debian:bullseye-slim as run
FROM node:22.2.0-bookworm as run

WORKDIR /app

COPY . .

RUN cd svelte && yarn install && yarn run build && cd ..
RUN cd websocketServer && yarn install && cd ..

COPY exec_all.sh exec_all.sh
RUN chmod +x exec_all.sh

# RUN apt-get update && apt-get install -y extra-runtime-dependencies && rm -rf /var/lib/apt/lists/*
COPY --from=builder /usr/local/cargo/bin/brain_fuck_interpreter /usr/local/bin/brain_fuck_interpreter

CMD ["brain_fuck_interpreter"]
CMD ["bash", "exec_all.sh"]
12 changes: 12 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: "3"
services:
brain_fuck_interpreter:
build:
context: .
dockerfile: Dockerfile
container_name: brain_fuck_interpreter
volumes:
- ./exec_all:/app/exec_all
ports:
- "3000:3000"
- "3001:3001"
9 changes: 9 additions & 0 deletions exec_all.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

cd websocketServer
(yarn start) &
cd ..
cd svelte
node build

trap "trap - SIGTERM && kill -- -$$" SIGINT SIGTERM EXIT

0 comments on commit 6dd91af

Please sign in to comment.