From 662b868330df9be0a7b079ab869df89c703b24e6 Mon Sep 17 00:00:00 2001 From: Jedrzej Golebiewski Date: Mon, 8 Jan 2024 22:22:20 +0000 Subject: [PATCH] Add frontend compilation step to deploy.yml workflow --- .github/workflows/deploy.yml | 21 --------------------- Dockerfile | 9 +++++++++ 2 files changed, 9 insertions(+), 21 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 65eea13..635a52d 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -25,27 +25,6 @@ jobs: with: fetch-depth: 0 - - name: Set Up Node.js For Frontend Compilation - uses: actions/setup-node@v4 - with: - node-version: 20 - - - name: Install Yarn - run: npm install -g yarn - - - name: Compile Frontend - run: | - cd frontend - yarn check --integrity || yarn install - yarn deploy - - - name: Amend compilation changes to last commit - run: | - git config --local user.email "action@github.com" - git config --local user.name "GitHub Action" - git add -A - git commit --amend --no-edit - - name: Dokku uses: dokku/github-action@v1.4.0 with: diff --git a/Dockerfile b/Dockerfile index a7f0df7..6e81bda 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,14 @@ # syntax = docker/dockerfile:1 +# Compile frontend in Node.js environment +FROM node:20-alpine as frontend + +WORKDIR /frontend + +COPY frontend ./ +RUN yarn install +RUN yarn deploy + # Make sure RUBY_VERSION matches the Ruby version in .ruby-version and Gemfile ARG RUBY_VERSION=3.1.2 FROM registry.docker.com/library/ruby:$RUBY_VERSION-slim as base