Skip to content

Commit

Permalink
add building docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexey-Sagaydak committed Sep 19, 2024
1 parent 2dc36d6 commit 8271940
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
18 changes: 13 additions & 5 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ run-name: ${{ github.actor }} run CI
on: [push]

jobs:

build-test:
runs-on: ubuntu-latest

Expand Down Expand Up @@ -44,11 +43,8 @@ jobs:
- name: Test 4. Test server
run: |
libhv-http & SERVER_PID=$!
sleep 5
curl --silent --head http://localhost:7777 | grep "HTTP/1.1 200 OK" > /dev/null
if [ "$?" -eq 0 ]; then
echo "Сервер успешно запущен"
kill $SERVER_PID
Expand All @@ -57,4 +53,16 @@ jobs:
echo "Ошибка при запуске сервера"
kill $SERVER_PID
exit 1
fi
fi
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build Docker image
run: docker build -t ${{ secrets.DOCKER_USERNAME }}/http-server:${{ github.sha }} .

- name: Push Docker image
run: docker push ${{ secrets.DOCKER_USERNAME }}/http-server:${{ github.sha }}
9 changes: 9 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM ubuntu:22.04

RUN apt-get update && apt-get install -y libboost-all-dev

COPY ./server/build/http-server /usr/local/bin/http-server

EXPOSE 7777

CMD ["http-server"]

0 comments on commit 8271940

Please sign in to comment.