diff --git a/Dockerfile b/Dockerfile index 4d050dd95..c02768ac8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 && \ @@ -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 && \ @@ -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 diff --git a/Makefile b/Makefile index 0687d166a..9a04ef132 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ .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)" @@ -8,10 +8,16 @@ 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 diff --git a/docker-compose-dev.yml b/docker-compose-dev.yml index 6ab3a48b5..b91320e01 100644 --- a/docker-compose-dev.yml +++ b/docker-compose-dev.yml @@ -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 @@ -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 diff --git a/docker-compose.yml b/docker-compose.yml index fd26afa3d..befd131b0 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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