-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
name: enochecker_test | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build: | ||
runs-on: self-hosted | ||
env: | ||
ENOCHECKER_TEST_CHECKER_ADDRESS: localhost | ||
ENOCHECKER_TEST_CHECKER_PORT: 5008 | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
submodules: recursive | ||
- name: Set up Python 3.9 | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.9 | ||
- name: Install enochecker_test | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install enochecker-test | ||
- name: start service | ||
run: | | ||
cd service | ||
docker-compose up --build --force-recreate -d | ||
- name: start checker | ||
run: | | ||
cd checker | ||
docker-compose up --build --force-recreate -d | ||
- name: obtain Docker host IP | ||
run: | | ||
echo "ENOCHECKER_TEST_SERVICE_ADDRESS=$(ip -4 address show dev eth0 | grep inet | awk '{ print $2 }' | sed 's|/.*$||')" >> $GITHUB_ENV | ||
- name: run enochecker_test | ||
run: | | ||
enochecker_test | ||
- name: Dump docker logs on failure | ||
if: failure() | ||
uses: jwalton/gh-docker-logs@v1 | ||
with: | ||
dest: './logs' | ||
- name: Tar logs | ||
if: failure() | ||
run: tar cvzf ./logs.tgz ./logs | ||
- name: Upload logs to GitHub | ||
if: failure() | ||
uses: actions/upload-artifact@master | ||
with: | ||
name: logs.tgz | ||
path: ./logs.tgz | ||
- name: Kill docker containers | ||
if: failure() || success() | ||
run: | | ||
(cd service && docker-compose kill) | ||
(cd checker && docker-compose kill) | ||
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 gcc python3 make gdb | ||
|
||
|
||
# Set the working directory inside the container to /mnt | ||
WORKDIR /mnt | ||
|
||
# Optional: Start a shell when the container runs, good for development | ||
CMD ["sh"] |
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# This file contains ignore-rules for files that are not tracked by docker for container builds. | ||
data/ | ||
.git/ | ||
Dockerfile | ||
docker-compose.yml | ||
.dockerignore | ||
.gitignore | ||
.env |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Docker-compose might get confused when there are multiple "service" directories, so let's help it by providing a specific project name. | ||
COMPOSE_PROJECT_NAME=pirateprattle_service |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
# Use https://gitignore.io/ to create a suitable .gitignore file for your project. | ||
data/ | ||
|
||
# Prerequisites | ||
*.d | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
version: "3" | ||
services: | ||
pirateprattle: | ||
build: . | ||
# The code should be copied into the container using COPY. | ||
# Mount the data folder writable, so that information can be persisted across restarts. | ||
volumes: | ||
- ./data/:/data:rw | ||
# Define the port mapping (external:internal port) | ||
ports: | ||
- "4444:4444" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,25 @@ | ||
# Use a suitable base-image. | ||
FROM ubuntu:22.04 | ||
RUN apt-get update && apt-get install -y gcc python3 make gdb | ||
|
||
# Create a seperate user and chown new directories if necessary | ||
RUN addgroup --system service | ||
RUN adduser --system --ingroup service --uid 1000 service | ||
|
||
# Set the working directory inside the container to /mnt | ||
WORKDIR /mnt | ||
# Create our mapped data volume endpoint | ||
RUN mkdir /data/ | ||
|
||
# Optional: Start a shell when the container runs, good for development | ||
CMD ["sh"] | ||
# Copy our entrypoint.sh and make it executable | ||
COPY entrypoint.sh / | ||
RUN chmod +x /entrypoint.sh | ||
|
||
# Copy our service (using 'src' here because the reference to splash_screen.txt is hardcoded, so needs to be same as the original) | ||
COPY src/ /src/ | ||
|
||
# Change the working directory. | ||
WORKDIR /src/ | ||
# Expose the service's port | ||
EXPOSE 4444 | ||
|
||
# Run the service | ||
ENTRYPOINT ["/entrypoint.sh"] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/sh | ||
set -e | ||
set -x | ||
|
||
# Chown the mounted data volume | ||
chown -R service:service "/data/" | ||
|
||
# Build the project | ||
make | ||
|
||
# Launch our service as user 'service' | ||
exec su -s /bin/sh -c './pirateprattle' service |
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.