Skip to content

Commit

Permalink
Docker build optimizations
Browse files Browse the repository at this point in the history
  • Loading branch information
aldwin7894 committed Aug 17, 2022
1 parent 007c624 commit 385f536
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
13 changes: 12 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,6 @@ bower.json
# Ignore precompiled javascript packs
/public/packs
/public/packs-test
/public/assets

# Ignore yarn files
/yarn-error.log
Expand Down Expand Up @@ -306,3 +305,15 @@ build-iPhoneSimulator/
# .rubocop-https?--*

# End of https://www.toptal.com/developers/gitignore/api/node,ruby,rails,linux,macos

**/cache
.asset_sync_remote_file_list_cache.json
*dump*
vendor
.git

# Vite Ruby
/public/vite*
# Vite uses dotenv and suggests to ignore local-only env files. See
# https://vitejs.dev/guide/env-and-mode.html#env-files
*.local
5 changes: 1 addition & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,13 @@ RUN apt-get update -yq \
&& tar xzf "node-v$NODE_VERSION-linux-x64.tar.gz" \
&& npm i -g npm@$NPM_VERSION yarn@$YARN_VERSION \
&& npm cache clean --force \
&& rm -f "/node-v$NODE_VERSION-linux-x64.tar.xz" \
&& rm -f "/node-v$NODE_VERSION-linux-x64.tar.gz" \
&& rm -rf /var/lib/apt/lists/* /usr/share/doc /usr/share/man \
&& apt-get clean \
&& apt-get autoremove

# enable jemalloc
ENV LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libjemalloc.so.2
# add node and npm to path so the commands are available
ENV NODE_PATH $NVM_DIR/v$NODE_VERSION/lib/node_modules
ENV PATH $NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH

COPY . /app
WORKDIR /app
Expand Down
5 changes: 3 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ services:
- TZ
- POSTGRES_PASSWORD
- POSTGRES_DB
ports:
- 5432:5432
volumes:
- "dbdata:/var/lib/postgresql/data"
redis:
Expand All @@ -29,7 +31,7 @@ services:
- db
- redis
ports:
- "3000:3000"
- 3000:3000
environment:
- "DATABASE_URL=postgres://postgres:${POSTGRES_PASSWORD}@db:5432/${POSTGRES_DB}"
- REDIS_URL=redis://redis:6379
Expand All @@ -41,7 +43,6 @@ services:
- OCCSON_ACCESS_TOKEN
- OCCSON_PASSPHRASE
volumes:
- .:/app
- ruby-gems:/gems

volumes:
Expand Down

0 comments on commit 385f536

Please sign in to comment.