mirror of
https://github.com/indentlabs/notebook.git
synced 2025-10-26 11:19:22 +00:00
Merge pull request #769 from SethiPandi/docker-improvement
Improve Development Docker Build
This commit is contained in:
commit
276b0e7ae2
15
.dockerignore
Normal file
15
.dockerignore
Normal file
@ -0,0 +1,15 @@
|
||||
# Don't include any of these files in the Dockerfile build context.
|
||||
# This will improve build performance and reduce the final image size.
|
||||
# See: https://docs.docker.com/engine/reference/builder/#dockerignore-file
|
||||
.git/
|
||||
.github/
|
||||
.coveralls.yml
|
||||
.dockerignore
|
||||
.editorconfig
|
||||
.gitignore
|
||||
.travis.yml
|
||||
.rubocop.yml
|
||||
CHANGELOG.md
|
||||
docker-compose.yml
|
||||
log/
|
||||
test/
|
||||
@ -1,2 +1 @@
|
||||
2.6.6
|
||||
|
||||
|
||||
36
Dockerfile
36
Dockerfile
@ -1,8 +1,32 @@
|
||||
# HEADS UP!
|
||||
# This Dockerfile is for DEVELOPMENT use only;
|
||||
# it's in no way optimized for production.
|
||||
|
||||
# The image to build from.
|
||||
FROM ruby:2.6.3
|
||||
RUN apt-get update -qq && \
|
||||
|
||||
# Properties/labels for the image.
|
||||
LABEL maintainer="Notebook.ai Contributors"
|
||||
|
||||
# Copy the current folder into the notebookai user's home directory.
|
||||
COPY . /home/notebookai
|
||||
|
||||
# Set the notebookai user's home directory as the working directory.
|
||||
WORKDIR /home/notebookai
|
||||
|
||||
# Prep the image for runtime, this should all be done in one command
|
||||
# to minimize image layers.
|
||||
# See: https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#minimize-the-number-of-layers
|
||||
RUN groupadd --system --gid 1000 notebookai && \
|
||||
useradd --system --home-dir /home/notebookai --gid notebookai --uid 1000 --shell /bin/bash notebookai && \
|
||||
apt-get update -qq && \
|
||||
apt-get install -y build-essential libpq-dev nodejs imagemagick libmagickwand-dev && \
|
||||
mkdir /notebook-ai
|
||||
COPY . /notebook-ai
|
||||
WORKDIR /notebook-ai
|
||||
RUN bundle install
|
||||
RUN rails db:setup
|
||||
rm --recursive --force /var/lib/apt/lists/* && \
|
||||
bundle install && \
|
||||
rails db:setup
|
||||
|
||||
# This image should expose the port 3000.
|
||||
# This does not actually expose the port, you'll have to expose it yourself by
|
||||
# using `-p 3000:3000/tcp` in Docker's CLI or `- "3000:3000"` in the in docker-compose.yml service's ports[].
|
||||
# https://docs.docker.com/engine/reference/builder/#expose
|
||||
EXPOSE 3000/tcp
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
version: '2'
|
||||
version: "3.8"
|
||||
services:
|
||||
web:
|
||||
build: .
|
||||
command: sh -c "rake db:migrate && rm -f tmp/pids/server.pid && exec bundle exec rails server -b '0.0.0.0'"
|
||||
volumes:
|
||||
- .:/notebook-ai
|
||||
ports:
|
||||
- "3000:3000"
|
||||
notebookai:
|
||||
build: .
|
||||
ports:
|
||||
- "3000:3000/tcp"
|
||||
command: sh -c "rake db:migrate && rm -f tmp/pids/server.pid && exec bundle exec rails server -b 0.0.0.0"
|
||||
volumes:
|
||||
- "./:/notebook-ai"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user