Add deploy step, update readme, copy less files to image

This commit is contained in:
Deko
2023-03-03 22:20:00 +01:00
parent 8e48cfc2d0
commit d97585900c
5 changed files with 46 additions and 4 deletions

1
.gitignore vendored
View File

@@ -1,2 +1,3 @@
.env
.idea/
.idea/vcs.xml

View File

@@ -1,6 +1,7 @@
stages:
- lint
- build
- deploy
.install-deps-script: &install-deps
- curl -sSL https://install.python-poetry.org | python -
@@ -17,6 +18,12 @@ stages:
before_script:
- *install-deps
######################################
# #
# LINT STEPS #
# #
######################################
black:
extends: .lint
script:
@@ -27,6 +34,11 @@ isort:
script:
- poetry run isort --check .
######################################
# #
# BUILD STEPS #
# #
######################################
build:
stage: build
@@ -43,3 +55,25 @@ build:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- docker build -f Dockerfile -t $IMAGE_TAG --build-arg version=$CI_COMMIT_SHA .
- docker push $IMAGE_TAG
######################################
# #
# DEPLOY STEPS #
# #
######################################
deploy:
stage: deploy
image: alpine:latest
before_script:
- 'command -v ssh-agent >/dev/null || ( apk add --update openssh )'
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- ssh-keyscan $REMOTE_HOST >> ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
script:
- ssh $SSH_USER@$REMOTE_HOST "bash -c 'cd /home/raphael/twitch-notifier && ./start.sh'"
only:
- main

View File

@@ -1,6 +1,9 @@
FROM python:3.11.2
COPY ./ /
COPY /poetry.lock /poetry.lock
COPY /pyproject.toml /pyproject.toml
COPY ./app /app
WORKDIR /
RUN apt-get update
RUN apt-get -y dist-upgrade

View File

@@ -56,3 +56,7 @@ python app/main.py
## Running in Docker
The second option is to run the project's docker image.
You have two paths you can take here as well:
1. You may fork the project and use the configured pipelines and container registry.
2. You may build the image yourself using the Dockerfile.