This commit is contained in:
jdenquin 2024-09-17 17:17:17 +02:00
parent f20e028d26
commit 34d4af1fb3
6 changed files with 37 additions and 64 deletions

View File

@ -1,71 +1,33 @@
ARG NODE_VERSION=20
ARG RUBY_VERSION=3.3.4
# # Front Build
# FROM node:$NODE_VERSION-alpine as front_build
# Front Build
FROM node:$NODE_VERSION-alpine as front_build
# WORKDIR /app
WORKDIR /app
# COPY ./front .
COPY ./front/ .
# RUN apk add python3 build-base
# RUN yarn && yarn build && npm prune --production
RUN apk add python3 build-base
RUN yarn && yarn build && npm prune --omit=dev
# # API Build
# FROM ruby:$RUBY_VERSION-slim as api_build
FROM ruby:$RUBY_VERSION-slim as api_build
# WORKDIR /app
WORKDIR /app
# COPY ./api/Gemfile ./Gemfile
# COPY ./api/Gemfile.lock ./Gemfile.lock
COPY ./api/Gemfile ./Gemfile
COPY ./api/Gemfile.lock ./Gemfile.lock
# RUN apt update -qq && apt install build-essential git pkg-config libpq-dev curl -y
# ENV BUNDLER_VERSION='2.5.5'
# ENV RAILS_ENV=production
# RUN gem install bundler --no-document -v '2.5.5'
# RUN bundle config build.nokogiri --use-system-libraries &&\
# bundle install --jobs=3 --retry=3 --without development test
RUN apt update -qq && apt install build-essential git pkg-config libpq-dev curl -y
ENV BUNDLER_VERSION='2.5.5'
ENV RAILS_ENV=production
RUN gem install bundler --no-document -v '2.5.5'
RUN bundle config build.nokogiri --use-system-libraries &&\
bundle install --jobs=3 --retry=3 --without development test
# Final Image
# FROM ruby:$RUBY_VERSION-slim
# ARG S6_OVERLAY_VERSION=3.2.0.0
# #RUN apt-get update -qq && apt-get install -y curl gnupg2
# #RUN curl http://nginx.org/keys/nginx_signing.key | apt-key add -
# RUN apt-get update -qq && \
# apt-get install -y nginx xz-utils
# # apt-get remove --purge -y gnupg2 && \
# # apt-get clean && \
# # rm -rf /var/lib/apt/lists/* /usr/share/doc /usr/share/man
# ADD https://github.com/just-containers/s6-overlay/releases/download/v$S6_OVERLAY_VERSION/s6-overlay-noarch.tar.xz /tmp
# RUN tar -C / -Jxpf /tmp/s6-overlay-noarch.tar.xz
# ADD https://github.com/just-containers/s6-overlay/releases/download/v$S6_OVERLAY_VERSION/s6-overlay-x86_64.tar.xz /tmp
# RUN tar -C / -Jxpf /tmp/s6-overlay-x86_64.tar.xz
# RUN rm -rf /tmp/s6-overlay-*.tar.xz
# COPY ./docker/rootfs /
# WORKDIR /app
# COPY --from=front_build /app/dist /usr/share/nginx/html
# COPY --from=api_build /usr/local/bundle/ /usr/local/bundle
# COPY ./front/.env.sh ./front/.env.sh
# COPY ./api ./api
# RUN bash -c ./front/.env.sh
# COPY ./front/nginx/nginx.conf /etc/nginx/sites-enabled/default
# ENV RAILS_ENV=production
# EXPOSE 80
# EXPOSE 3000
# ENTRYPOINT ["/init"]
FROM ruby:3.3.4-slim
FROM ruby:$RUBY_VERSION-slim
ARG S6_OVERLAY_VERSION=3.2.0.0
WORKDIR /app
@ -78,7 +40,20 @@ RUN tar -C / -Jxpf /tmp/s6-overlay-noarch.tar.xz
ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-x86_64.tar.xz /tmp
RUN tar -C / -Jxpf /tmp/s6-overlay-x86_64.tar.xz
COPY rootfs /
COPY docker/rootfs /
COPY ./front/nginx/nginx.conf /etc/nginx/sites-enabled/default
COPY --from=front_build /app/dist /usr/share/nginx/html
COPY --from=api_build /usr/local/bundle/ /usr/local/bundle
COPY ./front/.env.sh ./front/.env.sh
COPY ./api ./api
RUN bash -c ./front/.env.sh
ENV RAILS_ENV=production
EXPOSE 80
EXPOSE 3000
ENTRYPOINT ["/init"]

View File

@ -0,0 +1,3 @@
#!/command/execlineb -P
cd /app/api
./scripts/start.sh

View File

@ -1,4 +1,2 @@
#!/command/with-contenv bash
# shellcheck shell=bash
nginx -g "daemon off;"
#!/command/execlineb -P
nginx

View File

@ -1,3 +0,0 @@
#!/command/with-contenv bash
nginx -g "daemon off;"