summaryrefslogtreecommitdiffhomepage
path: root/Dockerfile
diff options
context:
space:
mode:
authorrealtradam <[email protected]>2024-06-16 16:21:17 -0400
committerrealtradam <[email protected]>2024-06-16 16:21:17 -0400
commitdc387a78548a152d0abea002c8afd86b71e5468a (patch)
treea1fbad9c210a7bfe2f20a700fd01f66905fa6e83 /Dockerfile
parentdb60994dfa088c44aecfceea6329934b1ce9f3b5 (diff)
downloadgameHolster-dc387a78548a152d0abea002c8afd86b71e5468a.tar.gz
gameHolster-dc387a78548a152d0abea002c8afd86b71e5468a.zip
change docker to build for alpine and postgres
Diffstat (limited to 'Dockerfile')
-rw-r--r--Dockerfile18
1 files changed, 11 insertions, 7 deletions
diff --git a/Dockerfile b/Dockerfile
index 11d58b9..48652ab 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -2,7 +2,8 @@
# Make sure RUBY_VERSION matches the Ruby version in .ruby-version and Gemfile
ARG RUBY_VERSION=3.2.2
-FROM registry.docker.com/library/ruby:$RUBY_VERSION-slim as base
+#FROM registry.docker.com/library/ruby:$RUBY_VERSION-slim as base
+FROM registry.docker.com/library/ruby:$RUBY_VERSION-alpine3.18 as base
# Rails app lives here
WORKDIR /rails
@@ -18,8 +19,9 @@ ENV RAILS_ENV="production" \
FROM base as build
# Install packages needed to build gems
-RUN apt-get update -qq && \
- apt-get install --no-install-recommends -y build-essential git libpq-dev libvips pkg-config
+#RUN apt-get update -qq && \
+# apt-get install --no-install-recommends -y build-essential git libpq-dev libvips pkg-config
+RUN apk add --update --no-cache build-base git vips postgresql-libs postgresql-dev tzdata
# Install application gems
COPY Gemfile Gemfile.lock ./
@@ -38,16 +40,18 @@ RUN bundle exec bootsnap precompile app/ lib/
FROM base
# Install packages needed for deployment
-RUN apt-get update -qq && \
- apt-get install --no-install-recommends -y curl libvips postgresql-client && \
- rm -rf /var/lib/apt/lists /var/cache/apt/archives
+#RUN apt-get update -qq && \
+# apt-get install --no-install-recommends -y curl libvips postgresql-client && \
+# rm -rf /var/lib/apt/lists /var/cache/apt/archives
+RUN apk add --update --no-cache curl vips postgresql-client
# Copy built artifacts: gems, application
COPY --from=build /usr/local/bundle /usr/local/bundle
COPY --from=build /rails /rails
# Run and own only the runtime files as a non-root user for security
-RUN useradd rails --create-home --shell /bin/bash && \
+#RUN useradd rails --create-home --shell /bin/bash && \
+RUN adduser rails --disabled-password --shell /bin/ash && \
chown -R rails:rails db log storage tmp
USER rails:rails