Skip to content

Commit 423880f

Browse files
authored
Merge pull request #31 from hexlet-components/deploy
Deploy
2 parents 7643ae0 + 2a66b3f commit 423880f

File tree

5 files changed

+59
-5
lines changed

5 files changed

+59
-5
lines changed

.github/workflows/main.yml

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ jobs:
1414
runs-on: ubuntu-latest
1515

1616
steps:
17-
- uses: actions/checkout@v3
18-
- uses: actions/setup-node@v3
17+
- uses: actions/checkout@v4
18+
- uses: actions/setup-node@v4
1919
with:
2020
node-version: '20'
2121
cache: 'npm'
@@ -27,3 +27,29 @@ jobs:
2727
make setup
2828
bin/rails assets:precompile
2929
make test
30+
31+
deploy:
32+
needs: build
33+
runs-on: ubuntu-latest
34+
if: ${{ github.event_name == 'push' }}
35+
36+
steps:
37+
- uses: actions/checkout@v4
38+
39+
- uses: docker/setup-buildx-action@v3
40+
41+
- name: Log in to GitHub Container Registry
42+
uses: docker/login-action@v3
43+
with:
44+
registry: ghcr.io
45+
username: ${{ github.actor }}
46+
password: ${{ secrets.GITHUB_TOKEN }}
47+
48+
- name: Build and push
49+
uses: docker/build-push-action@v6
50+
with:
51+
context: .
52+
push: true
53+
cache-from: ghcr.io/${{ github.repository }}:latest
54+
cache-to: type=inline
55+
tags: ghcr.io/${{ github.repository }}:latest

.ruby-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
ruby-3.2.1
1+
ruby-3.2.2

Dockerfile

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
FROM ruby:3.2.2
2+
3+
RUN apt-get update \
4+
&& apt-get install -y build-essential libpq-dev libsqlite3-dev curl
5+
6+
RUN curl -sL https://deb.nodesource.com/setup_20.x | bash -
7+
RUN apt-get install -y nodejs
8+
RUN npm install --global yarn
9+
10+
ENV DISABLE_SPRING=1
11+
ENV RAILS_SERVE_STATIC_FILES=enabled
12+
ENV RAILS_LOG_TO_STDOUT=enabled
13+
14+
WORKDIR /app
15+
16+
COPY Gemfile .
17+
COPY Gemfile.lock .
18+
RUN bundle install
19+
20+
COPY package.json .
21+
COPY yarn.lock .
22+
RUN yarn install
23+
24+
COPY . .
25+
26+
RUN bin/rails assets:precompile
27+
28+
CMD ["bash", "-c", "bin/rails db:prepare && bin/rails server"]

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
source 'https://rubygems.org'
44
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
55

6-
ruby '3.2.1'
6+
ruby '~> 3.2.2'
77

88
gem 'bootsnap', require: false
99
gem 'cssbundling-rails'

config/database.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ test:
2222

2323
production:
2424
<<: *default
25-
url: <%= ENV['DATABASE_URL'] %>
25+
url: db/production.sqlite3

0 commit comments

Comments
 (0)