Skip to content

Commit

Permalink
docker: change rust by golang for running and use golang websocket
Browse files Browse the repository at this point in the history
  • Loading branch information
tbmc committed Jun 4, 2024
1 parent db63f19 commit 543c755
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 29 deletions.
20 changes: 0 additions & 20 deletions .github/workflows/build_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,6 @@ on:
- "*.md"

jobs:
lint_websocket:
name: Lint WebSocket
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '22.2.0'
check-latest: true
- name: yarn install
working-directory: ./websocketServer
run: yarn install --frozen-lockfile
- name: lint
working-directory: ./websocketServer
run: |
yarn prettier-check
yarn lint
build_svelte:
name: Build and lint Svelte
runs-on: ubuntu-22.04
Expand Down
11 changes: 4 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
FROM rust:1.78-slim-buster as builder
FROM golang:1.22.3-alpine as builder

WORKDIR /usr/src/brainfuck_interpreter
WORKDIR /app
COPY . .

RUN cd rust && rustup target add x86_64-unknown-linux-musl \
&& cargo install --target=x86_64-unknown-linux-musl --path .
RUN cd golang && go build

FROM node:22.2.0-alpine as run

Expand All @@ -13,13 +12,11 @@ WORKDIR /app
COPY . .

RUN cd svelte && yarn install && yarn run build && cd .. \
&& cd websocketServer && yarn install && cd .. \
&& yarn cache clean

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/brainfuck_interpreter /usr/local/bin/brainfuck_interpreter
COPY --from=builder /app/golang/brainfuck /app/brainfuck

CMD ["sh", "exec_all.sh"]
3 changes: 1 addition & 2 deletions exec_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
cd svelte
(node build) &
cd ..
cd websocketServer
yarn start
./brainfuck

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

0 comments on commit 543c755

Please sign in to comment.