Skip to content

Commit

Permalink
set
Browse files Browse the repository at this point in the history
  • Loading branch information
msxavi committed Jul 14, 2024
1 parent 9544f8f commit d67cc15
Show file tree
Hide file tree
Showing 28 changed files with 843 additions and 360 deletions.
54 changes: 50 additions & 4 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,56 @@ on:
pull_request:
branches: [ "main" ]

env:
RAILS_ENV: test
TEST_IMAGE_TAG: wave:test
TEMP_IMAGE_NAME: image_

jobs:
build:
build-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- name: Cache Docker layers
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-multi-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-multi-buildx
- name: Build image
uses: docker/build-push-action@v5
with:
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new
context: .
target: build
tags: ${{ env.TEST_IMAGE_TAG }}
outputs: type=docker,dest=/tmp/${{ env.TEMP_IMAGE_NAME }}.tar

- name: DB Test Prepare
run: docker compose run --rm -e RAILS_ENV=test web bin/rails db:test:prepare
- name: Run Tests
run: docker compose run --rm -e RAILS_ENV=test web bin/rails spec

- name: Push Docker Image (if on main)
if: github.ref == 'refs/heads/main'
uses: docker/build-push-action@v5
with:
context: .
push: true
target: deployment
tags: ${{ env.TEST_IMAGE_TAG }}
#repository: your-docker-hub-username/your-repository-name

deploy:
needs: build-and-test
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
environment: production
steps:
- uses: actions/checkout@v4
- name: Build the Docker image
run: docker build . --file Dockerfile --tag wave:$(date +%s)
- name: Deploy to Production
run: |
# ... your deployment commands ...
38 changes: 0 additions & 38 deletions .github/workflows/ruby.yml

This file was deleted.

58 changes: 0 additions & 58 deletions .github/workflows/rubyonrails.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ruby-3.3.2
ruby-3.3.4
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ COPY . .
RUN bundle exec bootsnap precompile app/ lib/

# Precompiling assets for production without requiring secret RAILS_MASTER_KEY
RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile
#RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile

# Final stage for app image
FROM base as deployment
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
source "https://rubygems.org"

ruby "3.3.2"
ruby "3.3.4"

# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
gem "rails", "~> 7.1.3", ">= 7.1.3.3"
Expand Down
Loading

0 comments on commit d67cc15

Please sign in to comment.