Skip to content

Commit b2dcda1

Browse files
committed
[ci] Added Dockerfile and building container
1 parent 860c703 commit b2dcda1

3 files changed

Lines changed: 55 additions & 0 deletions

File tree

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
config.json

.github/workflows/ci-workflow.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Continuous integration
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
workflow_dispatch:
8+
9+
jobs:
10+
# Push image to GitHub Packages.
11+
# See also https://docs.docker.com/docker-hub/builds/
12+
push:
13+
runs-on: ubuntu-latest
14+
permissions:
15+
packages: write
16+
contents: read
17+
18+
steps:
19+
- uses: actions/checkout@v3
20+
21+
- name: Build image
22+
run: docker build . --file Dockerfile --tag omega-robot
23+
24+
- name: Log in to registry
25+
# This is where you will update the personal access token to GITHUB_TOKEN
26+
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin
27+
28+
- name: Push image
29+
run: |
30+
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/omega-robot
31+
# Change all uppercase to lowercase
32+
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
33+
# Strip git ref prefix from version
34+
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
35+
# Use Docker `latest` tag convention
36+
[ "$VERSION" == "master" ] && VERSION=latest
37+
echo IMAGE_ID=$IMAGE_ID
38+
echo VERSION=$VERSION
39+
docker tag omega-robot $IMAGE_ID:$VERSION
40+
docker push $IMAGE_ID:$VERSION

Dockerfile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Use node lts
2+
FROM python:alpine
3+
4+
# Set working directory
5+
WORKDIR /omega-robot/
6+
7+
# Install dependencies
8+
COPY requirements.pip ./
9+
RUN pip install -r requirements.pip
10+
11+
# Build
12+
COPY . ./
13+
14+
CMD python3 main.py

0 commit comments

Comments
 (0)