From 543c755e5efaee2517e6caeaa3702784aa479b7a Mon Sep 17 00:00:00 2001 From: Thibault Date: Tue, 4 Jun 2024 17:47:51 +0200 Subject: [PATCH] docker: change rust by golang for running and use golang websocket --- .github/workflows/build_test.yml | 20 -------------------- Dockerfile | 11 ++++------- exec_all.sh | 3 +-- 3 files changed, 5 insertions(+), 29 deletions(-) diff --git a/.github/workflows/build_test.yml b/.github/workflows/build_test.yml index 97f72fe..3a53027 100644 --- a/.github/workflows/build_test.yml +++ b/.github/workflows/build_test.yml @@ -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 diff --git a/Dockerfile b/Dockerfile index 969de82..4384af5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 @@ -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"] diff --git a/exec_all.sh b/exec_all.sh index 0d89357..febe358 100644 --- a/exec_all.sh +++ b/exec_all.sh @@ -4,7 +4,6 @@ cd svelte (node build) & cd .. -cd websocketServer -yarn start +./brainfuck trap "trap - SIGTERM && kill -- -$$" SIGINT SIGTERM EXIT