Skip to content

Commit

Permalink
ci: deploy the built Docker image
Browse files Browse the repository at this point in the history
Signed-off-by: Miquel Sabaté Solà <msabate@suse.com>
  • Loading branch information
mssola committed Mar 14, 2024
1 parent a779163 commit 7608bb7
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 16 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,35 @@ jobs:
run: |
bin/rails test
bin/rails test:system
deploy:
runs-on: ubuntu-latest
needs: [lint, test]
if: github.event_name == 'push'
steps:
- uses: actions/checkout@v2

- name: Build production Docker image
run: |
docker build --tag ${{ secrets.REGISTRY_HOST }}/${{ secrets.REGISTRY_USERNAME }}/operum:main .
- name: Push Docker image
run: |
# The login is done with the default docker password storage, which is
# not the safest around, but it will be removed by a subsequent logout
# later on.
docker login -u "${{ secrets.REGISTRY_USERNAME }}" -p "${{ secrets.REGISTRY_PASSWORD }}" ${{ secrets.REGISTRY_HOST }}
docker push ${{ secrets.REGISTRY_HOST }}/${{ secrets.REGISTRY_USERNAME }}/operum:main
docker logout ${{ secrets.REGISTRY_HOST }}
# The server provides a small script named `service-restart` which will do
# the right thing to pull the new image of the desired service and re-run
# it.
- name: Restart service with the new code
uses: garygrossgarten/github-action-ssh@release
with:
command: infra-restart operum
host: ${{ secrets.REMOTE_HOST }}
username: ${{ secrets.REMOTE_USERNAME }}
passphrase: ${{ secrets.REMOTE_PASSPHRASE }}
privateKey: ${{ secrets.PRIVATE_KEY}}
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,4 @@ ENTRYPOINT ["/rails/bin/docker-entrypoint"]

# Start the server by default, this can be overwritten at runtime
EXPOSE 3000
CMD ["thrust", "./bin/rails", "server"]
CMD ["./bin/rails", "server"]
1 change: 0 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ gem 'sqlite3', '~> 1.4'

# Web server.
gem 'puma', '>= 5.0'
gem 'thruster'

# Use JavaScript with ESM import maps.
gem 'importmap-rails'
Expand Down
6 changes: 0 additions & 6 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -271,11 +271,6 @@ GEM
railties (>= 6.0.0)
stringio (3.1.0)
thor (1.3.0)
thruster (0.1.0)
thruster (0.1.0-aarch64-linux)
thruster (0.1.0-arm64-darwin)
thruster (0.1.0-x86_64-darwin)
thruster (0.1.0-x86_64-linux)
timeout (0.4.1)
turbo-rails (2.0.4)
actionpack (>= 6.0.0)
Expand Down Expand Up @@ -326,7 +321,6 @@ DEPENDENCIES
sprockets-rails
sqlite3 (~> 1.4)
stimulus-rails
thruster
turbo-rails
web-console

Expand Down
22 changes: 14 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,20 @@
>
> &mdash; P. Ovidi Nasonis - Fasti 3.833-834
This is a small application in order to keep track of books, articles, papers,
etc.; that you might have and need to know where they are, reference it on a
paper, etc. To sum things up, it's a way to keep your bibliography under
control.

## Basic usage

To do.
This is a simple application that keeps track of all your sources (i.e. books,
papers, articles). With this information at hand you can:

- Add comments and notes to any source to keep track of what you found more
relevant from it.
- Tag sources and comments in the way you wish.
- Save searches that match on a user-defined tag, or a certain string from any
of your comments.
- Export searches into CSV or TeX so it can be used for building up bibliography
sections on a paper you might be working on.

The *workflow* revolves around the idea of being able to tag sources and
comments with tags that you might want to define, and then being able to list
sources with searches based on these tags.

## Deployment

Expand Down
5 changes: 5 additions & 0 deletions bin/docker-entrypoint
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

# If running the rails server then create or migrate existing database
if [ "${1}" == "./bin/rails" ] && [ "${2}" == "server" ]; then
# Create the database if it's not there already.
if [ ! -f "./storage/production.sqlite3" ]; then
./bin/rails db:create
fi

./bin/rails db:prepare
fi

Expand Down

0 comments on commit 7608bb7

Please sign in to comment.