-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Github actions & docker support (#46)
* Add dockerfile * Add workflow * GITHUB_* not allowed * lower case * push * add sourde * remove images asset * RAILS_LOG_LEVEL * Truncate instead of delete * Correct branch for workflows * Update bundler version attempt 1 * Update build.sh * Update build-and-publish.yml
- Loading branch information
1 parent
fa5452e
commit 3350f2d
Showing
18 changed files
with
112 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/bash | ||
# Install dependencies. | ||
export DEBIAN_FRONTEND=noninteractive | ||
apt-get update | ||
apt-get install -y \ | ||
build-essential \ | ||
ruby-full \ | ||
default-libmysqlclient-dev \ | ||
tzdata \ | ||
nodejs | ||
gem install bundler -v 2.3.26 | ||
bundle install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
rm tmp/pids/server.pid -rf | ||
bundle exec rake assets:precompile | ||
rails server |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/bin/bash | ||
rake db:migrate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/bin/bash | ||
rake seed -- --path=/seed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,18 @@ | ||
GITHUB_KEY= | ||
GITHUB_SECRET= | ||
|
||
SECRET_KEY_BASE= | ||
ELASTICSEARCH_URL=http://localhost:9200 | ||
|
||
ELASTICSEARCH_URL=http://localhost:9200 | ||
|
||
DATABASE_USERNAME= | ||
DATABASE_PASSWORD= | ||
DATABASE_HOST=127.0.0.1 | ||
DATABASE_PORT=3306 | ||
DATABASE_NAME= | ||
|
||
DEV_DATABASE_NAME= | ||
TEST_DATABASE_NAME= | ||
|
||
RAILS_LOG_TO_STDOUT= | ||
RAILS_LOG_LEVEL=info |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: Build and Publish | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
jobs: | ||
build-and-push-docker-image: | ||
name: Build Docker image and publish | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
# - name: Set up Docker Buildx | ||
# id: buildx | ||
# uses: docker/setup-buildx-action@v2 | ||
- name: Login to Github Packages | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ secrets.PUBLISHING_GITHUB_USERNAME }} | ||
password: ${{ secrets.PUBLISHING_GITHUB_TOKEN }} | ||
- name: Build image and push to Docker Hub and GitHub Container Registry | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: ./ | ||
tags: | | ||
ghcr.io/madgrades/api.madgrades.com:latest | ||
# push: true | ||
push: ${{ github.ref == 'refs/heads/main' }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
FROM ubuntu:bionic AS build | ||
WORKDIR /build | ||
COPY . . | ||
RUN .dockerfiles/build.sh | ||
|
||
FROM build AS app | ||
LABEL org.opencontainers.image.source https://github.com/Madgrades/api.madgrades.com | ||
WORKDIR /app | ||
COPY --from=build /build . | ||
# Default to running app. This can be overriden from docker cli. | ||
CMD .dockerfiles/run-app.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -272,7 +272,6 @@ PLATFORMS | |
DEPENDENCIES | ||
byebug | ||
capybara (~> 2.13) | ||
dotenv | ||
dotenv-rails | ||
font-awesome-rails | ||
jbuilder | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
//= link_tree ../images | ||
//= link_directory ../javascripts .js | ||
//= link_directory ../stylesheets .css |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
default: &default | ||
adapter: mysql2 | ||
encoding: utf8 | ||
pool: 10 | ||
username: <%= ENV['DATABASE_USERNAME'] %> | ||
password: <%= ENV['DATABASE_PASSWORD'] %> | ||
host: <%= ENV['DATABASE_HOST'] %> | ||
port: <%= ENV['DATABASE_PORT'] %> | ||
|
||
development: | ||
<<: *default | ||
database: <%= ENV['DEV_DATABASE_NAME'] %> | ||
|
||
test: | ||
<<: *default | ||
database: <%= ENV['TEST_DATABASE_NAME'] %> | ||
|
||
production: | ||
<<: *default | ||
database: <%= ENV['DATABASE_NAME'] %> |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters