Merge pull request 'Add CI step to build docker image' (#40) from docker into main
Some checks failed
Run unit tests / unit_tests (push) Successful in 9m46s
Build docker image / build-static-assets (push) Failing after 1h10m51s

Reviewed-on: #40
This commit is contained in:
bustikiller 2024-08-12 08:21:37 +00:00
commit 812f1171b4
2 changed files with 33 additions and 1 deletions

31
.github/workflows/build.yml vendored Normal file
View File

@ -0,0 +1,31 @@
name: Build docker image
on:
push:
branches:
- main
pull_request:
jobs:
build-static-assets:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: bustikiller/wedding-planner:latest
cache-from: type=registry,ref=user/app:latest
cache-to: type=inline

View File

@ -1,7 +1,7 @@
# syntax = docker/dockerfile:1
# Make sure RUBY_VERSION matches the Ruby version in .ruby-version and Gemfile
ARG RUBY_VERSION=3.2.0
ARG RUBY_VERSION=3.3.4
FROM registry.docker.com/library/ruby:$RUBY_VERSION-slim as base
# Rails app lives here
@ -13,6 +13,7 @@ ENV RAILS_ENV="production" \
BUNDLE_PATH="/usr/local/bundle" \
BUNDLE_WITHOUT="development"
RUN apt-get update && apt-get install -y nodejs
# Throw-away build stage to reduce size of final image
FROM base as build