Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementing multi-stage build workflow #2445

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 49 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,52 @@
FROM osem/base
FROM opensuse/leap:15 as base

# Import google packaging key for chrome
COPY google-packaging.key /tmp
RUN rpm --import /tmp/google-packaging.key

# Enable/Disable the repositories we need/don't need
RUN zypper rr openSUSE-Leap-15.0-Non-Oss openSUSE-Leap-15.0-Update-Non-Oss; \
zypper ar -f https://download.opensuse.org/repositories/devel:/tools/openSUSE_Leap_15.0/devel:tools.repo; \
zypper ar -f http://dl.google.com/linux/chrome/rpm/stable/x86_64 google-chrome; \
zypper --gpg-auto-import-keys refresh

# Install our requirements
RUN zypper -n install --no-recommends \
# for compiling assets/gems
nodejs8 gcc-c++ git-core make \
# for ...
ImageMagick \
# for bundler
sudo \
# as databases
libmariadb-devel postgresql-devel sqlite3-devel \
# for nokogiri
libxml2-devel libxslt-devel \
# for the interactive shell
ack curl wget w3m vim \
# for running our tests
phantomjs which \
# as ruby
ruby2.5-devel \
# as browser for feature tests
google-chrome-stable

# Setup sudo
RUN echo 'osem ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers

# Disable versioned gem binary names
RUN echo 'install: --no-format-executable' >> /etc/gemrc

# Install bundler & foreman
RUN gem install bundler:1.17.3 foreman

# Create our user
RUN useradd -m --user-group osem

CMD ["/bin/bash", "-l"]

FROM base

ARG CONTAINER_USERID

# Configure our user
Expand Down
47 changes: 0 additions & 47 deletions Dockerfile.base

This file was deleted.

49 changes: 48 additions & 1 deletion Dockerfile.production
Original file line number Diff line number Diff line change
@@ -1,4 +1,51 @@
FROM osem/base
FROM opensuse/leap:15 as base

# Import google packaging key for chrome
COPY google-packaging.key /tmp
RUN rpm --import /tmp/google-packaging.key

# Enable/Disable the repositories we need/don't need
RUN zypper rr openSUSE-Leap-15.0-Non-Oss openSUSE-Leap-15.0-Update-Non-Oss; \
zypper ar -f https://download.opensuse.org/repositories/devel:/tools/openSUSE_Leap_15.0/devel:tools.repo; \
zypper ar -f http://dl.google.com/linux/chrome/rpm/stable/x86_64 google-chrome; \
zypper --gpg-auto-import-keys refresh

# Install our requirements
RUN zypper -n install --no-recommends \
# for compiling assets/gems
nodejs8 gcc-c++ git-core make \
# for ...
ImageMagick \
# for bundler
sudo \
# as databases
libmariadb-devel postgresql-devel sqlite3-devel \
# for nokogiri
libxml2-devel libxslt-devel \
# for the interactive shell
ack curl wget w3m vim \
# for running our tests
phantomjs which \
# as ruby
ruby2.5-devel \
# as browser for feature tests
google-chrome-stable

# Setup sudo
RUN echo 'osem ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers

# Disable versioned gem binary names
RUN echo 'install: --no-format-executable' >> /etc/gemrc

# Install bundler & foreman
RUN gem install bundler:1.17.3 foreman

# Create our user
RUN useradd -m --user-group osem

CMD ["/bin/bash", "-l"]

FROM base

# Add our files
COPY --chown=1000:1000 . /osem/
Expand Down
17 changes: 12 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
version: "2"
version: '3.5'

services:

database:
image: postgres
environment:
PGDATA: /var/lib/postgresql/data/pgdata
osem:
container_name: osem-db
image: postgres:11
volumes:
- pg-data:/var/lib/postgresql/data

web:
container_name: osem-web
build:
context: .
args:
Expand All @@ -17,3 +21,6 @@ services:
- 3000:3000
volumes:
- .:/osem

volumes:
pg-data: