Update Dockerfile-ubuntu #424
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Docker Image CI | |
on: [push] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
services: | |
mongo: | |
image: mongo:5-focal | |
ports: | |
- 57010:27017 | |
redis: | |
image: redis:bookworm | |
ports: | |
- 56310:6379 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build the Docker image | |
run: docker build . --file Dockerfile --tag my-image-name | |
- run: docker image ls my-image-name | |
- run: docker history my-image-name | |
- name: Copy Configure | |
run: cp test/test.yml .config/default.yml | |
- name: Start Docker container | |
run: | | |
docker run -d --net=host -v ./.config:/misskey/.config:ro --name my-container my-image-name | |
sleep 60 | |
- name: Check Docker container logs | |
run: docker logs my-container | |
- name: Test HTTP request to container | |
run: | | |
response=$(curl --retry 10 -X POST -s -o /dev/null -w "%{http_code}" http://localhost:8010/api/meta) | |
if [ $response -eq 200 ]; then | |
echo "HTTP request successful. Status code: $response" | |
else | |
echo "HTTP request failed with status code: $response" | |
exit 1 | |
fi | |
- name: Stop Docker container | |
run: docker stop my-container | |
build-alpine: | |
runs-on: ubuntu-latest | |
services: | |
mongo: | |
image: mongo:5-focal | |
ports: | |
- 57010:27017 | |
redis: | |
image: redis:bookworm | |
ports: | |
- 56310:6379 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Build the Docker image for alpine | |
run: docker build . --file Dockerfile-alpine --tag my-image-name-alpine | |
- run: docker image ls my-image-name-alpine | |
- run: docker history my-image-name-alpine | |
- name: Copy Configure | |
run: cp test/test.yml .config/default.yml | |
- name: Start Docker container | |
run: | | |
docker run -d --net=host -v ./.config:/misskey/.config:ro --name my-container my-image-name-alpine | |
sleep 60 | |
- name: Check Docker container logs | |
run: docker logs my-container | |
- name: Test HTTP request to container | |
run: | | |
response=$(curl --retry 10 -X POST -s -o /dev/null -w "%{http_code}" http://localhost:8010/api/meta) | |
if [ $response -eq 200 ]; then | |
echo "HTTP request successful. Status code: $response" | |
else | |
echo "HTTP request failed with status code: $response" | |
exit 1 | |
fi | |
- name: Stop Docker container | |
run: docker stop my-container | |
build-fedora: | |
runs-on: ubuntu-latest | |
services: | |
mongo: | |
image: mongo:5-focal | |
ports: | |
- 57010:27017 | |
redis: | |
image: redis:bookworm | |
ports: | |
- 56310:6379 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Build the Docker image for fedora | |
run: docker build . --file Dockerfile-fedora --tag my-image-name-fedora | |
- run: docker image ls my-image-name-fedora | |
- run: docker history my-image-name-fedora | |
- name: Copy Configure | |
run: cp test/test.yml .config/default.yml | |
- name: Start Docker container | |
run: | | |
docker run -d --net=host -v ./.config:/misskey/.config:ro --name my-container my-image-name-fedora | |
sleep 60 | |
- name: Check Docker container logs | |
run: docker logs my-container | |
- name: Test HTTP request to container | |
run: | | |
response=$(curl --retry 10 -X POST -s -o /dev/null -w "%{http_code}" http://localhost:8010/api/meta) | |
if [ $response -eq 200 ]; then | |
echo "HTTP request successful. Status code: $response" | |
else | |
echo "HTTP request failed with status code: $response" | |
exit 1 | |
fi | |
- name: Stop Docker container | |
run: docker stop my-container | |
build-ubuntu: | |
runs-on: ubuntu-latest | |
services: | |
mongo: | |
image: mongo:5-focal | |
ports: | |
- 57010:27017 | |
redis: | |
image: redis:bookworm | |
ports: | |
- 56310:6379 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Build the Docker image for ubuntu | |
run: docker build . --file Dockerfile-ubuntu --tag my-image-name-ubuntu | |
- run: docker image ls my-image-name-ubuntu | |
- run: docker history my-image-name-ubuntu | |
- name: Copy Configure | |
run: cp test/test.yml .config/default.yml | |
- name: Start Docker container | |
run: | | |
docker run -d --net=host -v ./.config:/misskey/.config:ro --name my-container my-image-name-ubuntu | |
sleep 60 | |
- name: Check Docker container logs | |
run: docker logs my-container | |
- name: Test HTTP request to container | |
run: | | |
response=$(curl --retry 10 -X POST -s -o /dev/null -w "%{http_code}" http://localhost:8010/api/meta) | |
if [ $response -eq 200 ]; then | |
echo "HTTP request successful. Status code: $response" | |
else | |
echo "HTTP request failed with status code: $response" | |
exit 1 | |
fi | |
- name: Stop Docker container | |
run: docker stop my-container |