Unfortunately there is no way to 'unset' an ENV in a Dockerfile. We were working around this by setting `RAILS_ENV` to an empty string in the discourse_dev dockerfile, but that didn't work in every situation.
The discourse_dev image doesn't rely on anything in the 'release' layer of the base image. In fact, it deletes the entire contents of `/var/www/*`.
This commit resolves the situation by:
- Moving the `RAILS_ENV=production` line to the 'release' layer of the base image
- Updating the discourse_dev image to be based on the 'slim' base image
FROM $from:$tag
+ENV RAILS_ENV=production
+
RUN cd /var/www/discourse &&\
sudo -u discourse bundle config --local deployment true &&\
sudo -u discourse bundle config --local path ./vendor/bundle &&\
ENV PG_MAJOR=13 \
RUBY_ALLOCATOR=/usr/lib/libjemalloc.so.1 \
- RAILS_ENV=production \
RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo \
PATH=/usr/local/cargo/bin:$PATH \
# NAME: discourse/discourse_dev
# VERSION: release
-FROM discourse/base:release
-
-# Unset RAILS_ENV to allow running both dev stuff and tests
-ENV RAILS_ENV=
+FROM discourse/base:slim
#LABEL maintainer="Sam Saffron \"https://twitter.com/samsaffron\""