Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
123 changes: 5 additions & 118 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,121 +9,8 @@ on:
pull_request:

jobs:
lint:
name: ubuntu-latest - Docker - lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5

- name: Run hadolint
uses: reviewdog/action-hadolint@v1
with:
github_token: ${{ secrets.github_token }}
hadolint_ignore: DL3013 DL3008

build_test_push:
needs: lint
name: ubuntu-latest - Docker - build & test & push
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v5

- name: Set Environment Variables
run: |
OWNER="$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]' | tr -d '-')"
IMG=octobot
echo "VERSION=${GITHUB_REF##*/}" >> $GITHUB_ENV
echo "IMAGE=${OWNER}/${IMG}" >> $GITHUB_ENV
echo "DISTRIBUTION_NAME=marketmaking" >> $GITHUB_ENV
echo "LATEST=latest" >> $GITHUB_ENV
echo "STAGING=staging" >> $GITHUB_ENV
echo "STABLE=stable" >> $GITHUB_ENV
echo "SHA=${GITHUB_SHA}" >> $GITHUB_ENV
echo "CONTAINER_NAME=octobot" >> $GITHUB_ENV

- name: Set up QEMU
id: qemu-setup
uses: docker/setup-qemu-action@master
with:
platforms: all

- name: Print available platforms
run: echo ${{ steps.qemu.outputs.platforms }}

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@master
with:
driver: docker-container
use: true

- name: Cache Docker layers
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-

- name: Login to DockerHub
if: github.event_name == 'push'
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push latest
if: github.event_name == 'push' && !startsWith(github.ref, 'refs/tags') && github.ref == 'refs/heads/dev'
uses: docker/build-push-action@master
with:
context: .
builder: ${{ steps.buildx.outputs.name }}
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ env.IMAGE }}:${{ env.DISTRIBUTION_NAME }}-${{ env.LATEST }}
build-args: |
BASE_IMAGE_TAG=${{ env.LATEST }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache

- name: Build and push staging
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
uses: docker/build-push-action@master
with:
context: .
builder: ${{ steps.buildx.outputs.name }}
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ env.IMAGE }}:${{ env.DISTRIBUTION_NAME }}-${{ env.STAGING }}
build-args: |
BASE_IMAGE_TAG=${{ env.STABLE }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache

- name: Build and push on tag
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: docker/build-push-action@master
with:
context: .
file: ./Dockerfile
builder: ${{ steps.buildx.outputs.name }}
platforms: linux/amd64,linux/arm64
push: true
tags: |
${{ env.IMAGE }}:${{ env.DISTRIBUTION_NAME }}-${{ env.LATEST }}
${{ env.IMAGE }}:${{ env.DISTRIBUTION_NAME }}-${{ env.STABLE }}
${{ env.IMAGE }}:${{ env.DISTRIBUTION_NAME }}-${{ env.VERSION }}
build-args: |
BASE_IMAGE_TAG=${{ env.VERSION }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache

notify:
if: ${{ failure() }}
needs:
- lint
- build_test_push
uses: Drakkar-Software/.github/.github/workflows/failure_notify_workflow.yml@master
secrets:
DISCORD_GITHUB_WEBHOOK: ${{ secrets.DISCORD_GITHUB_WEBHOOK }}
docker:
uses: Drakkar-Software/.github/.github/workflows/docker_workflow.yml@master
with:
distribution_name: marketmaking
secrets: inherit
18 changes: 1 addition & 17 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,7 @@
ARG BASE_IMAGE_TAG=stable
FROM drakkarsoftware/octobot:$BASE_IMAGE_TAG AS base

WORKDIR /

# Make sure we use the virtualenv:
ENV PATH="/opt/venv/bin:$PATH"

COPY . .
RUN pip install --no-cache-dir -U setuptools wheel pip>=20.0.0 \
&& pip install --no-cache-dir --prefer-binary -r requirements.txt \
&& python setup.py install \
&& mv /opt/venv/bin/OctoBot_Market_Making /opt/venv/bin/OctoBot

FROM drakkarsoftware/octobot:$BASE_IMAGE_TAG

WORKDIR /octobot

# Import python dependencies
COPY --from=base /opt/venv /opt/venv

# Add default config files
ENV DEFAULT_CONFIG_FILE=/octobot/octobot/config/default_config.json
COPY octobot_market_making/config/default_config.json /octobot/octobot/config/default_config.json