Skip to content

Commit 5e88216

Browse files
committed
remove private registry dependency for local development
1 parent 6600089 commit 5e88216

8 files changed

+656
-25
lines changed

.dockerignore

-8
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,6 @@ spec/dummy/public/packs-test/
88
spec/dummy/yarn-error.log
99
spec/dummy/storage/
1010
spec/dummy/tmp/
11-
builder/db/*.sqlite3
12-
builder/db/*.sqlite3-journal
13-
builder/log/*.log
14-
builder/node_modules/
15-
builder/yarn-error.log
16-
builder/storage/
17-
builder/tmp/
18-
builder/public/packs
1911
.idea/
2012
.vscode
2113
.byebug_history

Dockerfile.postgres

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
FROM postgres:10.6-alpine
2+
3+
COPY setpw.sh /usr/bin/
4+
RUN chmod +x /usr/bin/setpw.sh

Dockerfile.release

+26-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,26 @@
1-
FROM registry.gitlab.com/basemate-ops/workflow/release:latest
1+
FROM ruby:2.7.2-alpine3.12
2+
3+
RUN gem install bundler:2.1.4
4+
5+
RUN apk update --no-cache && \
6+
apk add build-base postgresql-dev git nodejs yarn tzdata bash sqlite-dev npm && \
7+
mkdir -p /app
8+
9+
WORKDIR /app
10+
11+
COPY ./lib/ /app/lib/
12+
COPY matestack-ui-bootstrap.gemspec /app/
13+
COPY Gemfile* yarn* /app/
14+
RUN bundle install
15+
16+
COPY package.json* /app/
17+
RUN yarn install
18+
19+
COPY entrypoint.sh /usr/bin/
20+
RUN chmod +x /usr/bin/entrypoint.sh
21+
ENTRYPOINT ["entrypoint.sh"]
22+
23+
COPY . /app/
24+
RUN touch /app/.env && set -a && source /app/.env && set +a && bundle exec rails assets:precompile RAILS_ENV=production
25+
26+
CMD ["bundle", "exec", "rails", "server"]

docker-compose.production.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ version: '3'
22
services:
33

44
postgres:
5-
image: registry.gitlab.com/basemate-ops/workflow/postgres
5+
build:
6+
context: .
7+
dockerfile: ./Dockerfile.postgres
68
expose:
79
- 5432
810
volumes:

docker-compose.yml

+3-15
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ version: '3'
22
services:
33

44
postgres:
5-
image: registry.gitlab.com/basemate-ops/workflow/postgres
5+
build:
6+
context: .
7+
dockerfile: ./Dockerfile.postgres
68
expose:
79
- 5432
810
volumes:
@@ -44,20 +46,6 @@ services:
4446
volumes:
4547
- redis-volume:/data
4648

47-
# webpack-watcher:
48-
# build:
49-
# context: .
50-
# dockerfile: ./Dockerfile.dev
51-
# environment:
52-
# RAILS_ENV: development
53-
# volumes:
54-
# - ./:/app
55-
# - gem-volume:/usr/local/bundle
56-
# - node-volume:/app/node_modules
57-
# - builder-node-volume:/app/builder/node_modules
58-
# command: "sh -c 'cd builder && ./bin/webpack --watch'"
59-
# user: ${CURRENT_UID}
60-
6149
volumes:
6250
data-volume:
6351
gem-volume:

entrypoint.sh

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
set -e
3+
4+
# bundle install runs initally ON BUILD which installs all required gems
5+
# this creates a Gemfile.lock on the image /app/Gemfile.lock
6+
# mounting a directory without Gemfile.lock on image:/app causes Gemfile.lock to disappear
7+
# therefore:
8+
# If no Gemfile.lock is present, run bundle install again (should be very fast)
9+
if [[ ! -e /app/Gemfile.lock ]]; then
10+
bundle install
11+
fi
12+
13+
# Remove a potentially pre-existing server.pid for Rails.
14+
rm -f /app/tmp/pids/server.pid
15+
16+
# Then exec the container's main process (what's set as CMD in the Dockerfile).
17+
exec "$@"

setpw.sh

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/bash
2+
psql -U postgres -c "ALTER USER postgres WITH PASSWORD '$POSTGRES_PASSWORD'"

spec/dummy/log/development.log

+601
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)