Skip to content

Commit

Permalink
fix dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
mortbauer committed Dec 23, 2024
1 parent a31f227 commit e9854fe
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 7 deletions.
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ruby:2.7.8 as builder
FROM ruby:2.7.8 AS builder

RUN supercronicUrl=https://github.com/aptible/supercronic/releases/download/v0.1.3/supercronic-linux-amd64 && \
supercronicBin=/usr/local/bin/supercronic && \
Expand Down Expand Up @@ -41,7 +41,7 @@ RUN echo 'gem: --no-document' >> ~/.gemrc && \
bundle exec whenever >crontab


FROM builder as compiler
FROM builder AS compiler

# compile assets with temporary mysql server
RUN export DATABASE_URL=mysql2://localhost/test?encoding=utf8 && \
Expand All @@ -60,12 +60,12 @@ RUN export DATABASE_URL=mysql2://localhost/test?encoding=utf8 && \
/etc/init.d/mariadb stop && \
cp -r /usr/local/bundle /bundle

FROM builder as dev
FROM builder AS dev

RUN gem install rubocop-rails rubocop-rspec rubocop-capybara rubocop-factory_bot


FROM builder as app
FROM builder AS app
COPY --from=compiler /bundle /usr/local/bundle
COPY --from=compiler /usr/src/app/public /usr/src/app/public
COPY --from=compiler /usr/src/app/config /usr/src/app/config
Expand Down
10 changes: 8 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
.PHONY: image-dev image-prod image-prod-dev

IMAGE_NAME=foodsoft
IMAGE_NAME=mortbauer/foodsoft
IMAGE_TAG:=latest
BUILD_ARGS:= --build-arg REVISION="$(shell git rev-parse HEAD)" --build-arg BUILDTIME="$(shell date --rfc-3339=seconds)"

image-dev:
docker buildx build --tag ${IMAGE_NAME}-rubocop:${IMAGE_TAG} --progress=plain --target=dev .

image-prod:
docker buildx build --tag ${IMAGE_NAME}:${IMAGE_TAG} --no-cache --progress=plain --target=app ${BUILD_ARGS} .
docker buildx build --builder default --tag ${IMAGE_NAME}:${IMAGE_TAG} --progress=plain --target=app ${BUILD_ARGS} .

image-prod-push:
docker buildx build --builder default --tag ${IMAGE_NAME}:${IMAGE_TAG} --progress=plain --target=app ${BUILD_ARGS} --push .

image-prod-dev:
docker buildx build --tag ${IMAGE_NAME}:${IMAGE_TAG} --progress=plain --target=app ${BUILD_ARGS} .

rubocop:
docker run --rm -it -v ${PWD}:/work:ro --workdir /work foodsoft-rubocop bash

cleanup-routes:
git checkout plugins/*/config/routes.rb
5 changes: 4 additions & 1 deletion docker-compose-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ services:
- DATABASE_CLEANER_ALLOW_REMOTE_DATABASE_URL=true
- MAILCATCHER_ADDRESS=mailcatcher
- MAILCATCHER_PORT=25
- SECRET_KEY_BASE=lwkuewlje

mailcatcher:
image: tophfr/mailcatcher
Expand All @@ -34,8 +35,10 @@ services:
environment:
- MYSQL_ROOT_PASSWORD=secret
- MYSQL_DATABASE=development
ports:
- 3306:3306
volumes:
- mariadb:/var/lib/mysql
- ./data/mariadb:/var/lib/mysql

phpmyadmin:
image: phpmyadmin/phpmyadmin
Expand Down
3 changes: 3 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ services:
- FOODSOFT_DB_USER=root
- FOODSOFT_DB_PASSWORD=secret
- RAILS_FORCE_SSL=false
depends_on:
- mariadb
- redis

mailcatcher:
image: tophfr/mailcatcher
Expand Down

0 comments on commit e9854fe

Please sign in to comment.