forked from pglombardo/PasswordPusher
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DOCKER: Introduce universal docker image (pglombardo#1369)
* added dockerfile for unified docker image and example docker compose files * let old obsolete docker image use new unified image as base image and add deprecation note * reconfigured github build action to respect docker container image changes * ignore '.github' directory for docker builds
- Loading branch information
Showing
14 changed files
with
431 additions
and
263 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
# ignore all Dockerfile copies into the containers since they're not reqiured there | ||
# and speedup delevoping Dockerfiles | ||
**/Dockerfile | ||
.git | ||
.git | ||
.github |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,72 +1,22 @@ | ||
# pwpush-ephemeral | ||
FROM ruby:3.2-alpine AS build-env | ||
|
||
LABEL maintainer='[email protected]' | ||
|
||
# Required packages | ||
RUN apk upgrade --no-cache \ | ||
&& apk add --no-cache build-base git curl tzdata zlib-dev nodejs yarn libc6-compat sqlite-dev | ||
|
||
ENV APP_ROOT=/opt/PasswordPusher PATH=${APP_ROOT}:${PATH} HOME=${APP_ROOT} | ||
|
||
RUN mkdir -p ${APP_ROOT} | ||
COPY ./ ${APP_ROOT}/ | ||
|
||
WORKDIR ${APP_ROOT} | ||
|
||
# Setting DATABASE_URL is necessary for building. | ||
ENV DATABASE_URL=sqlite3:db/db.sqlite3 | ||
|
||
RUN gem install bundler | ||
|
||
ENV RACK_ENV=private RAILS_ENV=private | ||
|
||
RUN bundle config set without 'development production test' \ | ||
&& bundle config set with 'sqlite' \ | ||
&& bundle config set deployment 'true' \ | ||
&& bundle install \ | ||
&& yarn install | ||
|
||
RUN bundle exec rails assets:precompile && bundle exec rake db:setup | ||
|
||
# Removing unneccesary files/directories | ||
RUN rm -rf node_modules tmp/cache vendor/assets spec \ | ||
&& rm -rf vendor/bundle/ruby/*/cache/*.gem \ | ||
&& find vendor/bundle/ruby/*/gems/ -name "*.c" -delete \ | ||
&& find vendor/bundle/ruby/*/gems/ -name "*.o" -delete | ||
|
||
################## Build done ################## | ||
|
||
FROM ruby:3.2-alpine | ||
|
||
LABEL maintainer='[email protected]' | ||
|
||
# install packages | ||
RUN apk upgrade --no-cache \ | ||
&& apk add --no-cache tzdata bash nodejs libc6-compat | ||
|
||
# Create a user and group to run the application | ||
ARG UID=1000 | ||
ARG GID=1000 | ||
|
||
RUN addgroup -g "${GID}" pwpusher \ | ||
&& adduser -D -u "${UID}" -G pwpusher pwpusher | ||
|
||
|
||
|
||
ENV LC_CTYPE=UTF-8 LC_ALL=en_US.UTF-8 | ||
ENV APP_ROOT=/opt/PasswordPusher PATH=${APP_ROOT}:${PATH} HOME=${APP_ROOT} | ||
WORKDIR ${APP_ROOT} | ||
ENV RACK_ENV=private RAILS_ENV=private | ||
|
||
RUN mkdir -p ${APP_ROOT} && chown -R pwpusher:pwpusher ${APP_ROOT} | ||
COPY --from=build-env --chown=pwpusher:pwpusher ${APP_ROOT} ${APP_ROOT} | ||
|
||
ENV DATABASE_URL=sqlite3:db/db.sqlite3 | ||
RUN bundle config set without 'development production test' \ | ||
&& bundle config set with 'sqlite' \ | ||
&& bundle config set deployment 'true' | ||
|
||
USER pwpusher | ||
EXPOSE 5100 | ||
ENTRYPOINT ["containers/docker/pwpush-ephemeral/entrypoint.sh"] | ||
# Using universal image as a base for old non universal image | ||
# this is for the transition phase since these old image will become obsolete | ||
ARG BASEIMAGE=pwpush:latest | ||
FROM $BASEIMAGE | ||
|
||
# Insert decrecation note to inform users while spinning up containers | ||
RUN sed -i '5 a \ | ||
echo " ########################################################################## "\n \ | ||
echo " ### !!DEPRECATION NOTIFICATION!! ### "\n \ | ||
echo " ### THIS IMAGE IS DEPRECATED. SUPPORT FOR THIS IMAGE WILL BE DROPPED ### "\n \ | ||
echo " ### IN THE NEAR FUTURE. PLEASE MIGRATE TO THE NEW IMAGE ### "\n \ | ||
echo " ### ### "\n \ | ||
echo " ### FOR MORE INFORMATION GOTO ### "\n \ | ||
echo " ### https://github.com/pglombardo/PasswordPusher ### "\n \ | ||
echo " ### !!DEPRECATION NOTIFICATION!! ### "\n \ | ||
echo " ########################################################################## "\n \ | ||
' ./containers/docker/pwpush/entrypoint.sh | ||
|
||
# Setting database backend | ||
ENV DATABASE_URL=sqlite3:db/db.sqlite3 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,70 +1,22 @@ | ||
# pwpush-mysql | ||
FROM ruby:3.2-alpine AS build-env | ||
|
||
LABEL maintainer='[email protected]' | ||
|
||
# Required packages | ||
RUN apk upgrade --no-cache \ | ||
&& apk add --no-cache build-base git curl tzdata zlib-dev nodejs yarn libc6-compat mariadb-dev | ||
|
||
ENV APP_ROOT=/opt/PasswordPusher PATH=${APP_ROOT}:${PATH} HOME=${APP_ROOT} | ||
|
||
RUN mkdir -p ${APP_ROOT} | ||
COPY ./ ${APP_ROOT}/ | ||
|
||
WORKDIR ${APP_ROOT} | ||
|
||
# Setting DATABASE_URL is necessary for building. | ||
ENV DATABASE_URL=mysql2://passwordpusher_user:passwordpusher_passwd@mysql:3306/passwordpusher_db | ||
|
||
RUN gem install bundler | ||
|
||
ENV RACK_ENV=production RAILS_ENV=production RAILS_SERVE_STATIC_FILES=true | ||
|
||
RUN bundle config set without 'development private test' \ | ||
&& bundle config set with 'mysql' \ | ||
&& bundle config set deployment 'true' \ | ||
&& bundle install \ | ||
&& yarn install | ||
|
||
RUN bundle exec rails assets:precompile | ||
|
||
# Removing unneccesary files/directories | ||
RUN rm -rf node_modules tmp/cache vendor/assets spec \ | ||
&& rm -rf vendor/bundle/ruby/*/cache/*.gem \ | ||
&& find vendor/bundle/ruby/*/gems/ -name "*.c" -delete \ | ||
&& find vendor/bundle/ruby/*/gems/ -name "*.o" -delete | ||
|
||
################## Build done ################## | ||
|
||
FROM ruby:3.2-alpine | ||
|
||
LABEL maintainer='[email protected]' | ||
|
||
# install packages | ||
RUN apk upgrade --no-cache \ | ||
&& apk add --no-cache tzdata bash nodejs libc6-compat mariadb-connector-c | ||
|
||
# Create a user and group to run the application | ||
ARG UID=1000 | ||
ARG GID=1000 | ||
|
||
RUN addgroup -g "${GID}" pwpusher \ | ||
&& adduser -D -u "${UID}" -G pwpusher pwpusher | ||
|
||
ENV LC_CTYPE=UTF-8 LC_ALL=en_US.UTF-8 | ||
ENV APP_ROOT=/opt/PasswordPusher PATH=${APP_ROOT}:${PATH} HOME=${APP_ROOT} | ||
WORKDIR ${APP_ROOT} | ||
ENV RACK_ENV=production RAILS_ENV=production RAILS_SERVE_STATIC_FILES=true | ||
|
||
RUN mkdir -p ${APP_ROOT} && chown -R pwpusher:pwpusher ${APP_ROOT} | ||
COPY --from=build-env --chown=pwpusher:pwpusher ${APP_ROOT} ${APP_ROOT} | ||
|
||
ENV DATABASE_URL=mysql2://passwordpusher_user:passwordpusher_passwd@mysql:3306/passwordpusher_db | ||
RUN bundle config set without 'development private test' \ | ||
&& bundle config set with 'mysql' \ | ||
&& bundle config set deployment 'true' | ||
|
||
USER pwpusher | ||
EXPOSE 5100 | ||
ENTRYPOINT ["containers/docker/pwpush-mysql/entrypoint.sh"] | ||
# Using universal image as a base for old non universal image | ||
# this is for the transition phase since these old image will become obsolete | ||
ARG BASEIMAGE=pwpush:latest | ||
FROM $BASEIMAGE | ||
|
||
# Insert decrecation note to inform users while spinning up containers | ||
RUN sed -i '5 a \ | ||
echo " ########################################################################## "\n \ | ||
echo " ### !!DEPRECATION NOTIFICATION!! ### "\n \ | ||
echo " ### THIS IMAGE IS DEPRECATED. SUPPORT FOR THIS IMAGE WILL BE DROPPED ### "\n \ | ||
echo " ### IN THE NEAR FUTURE. PLEASE MIGRATE TO THE NEW IMAGE ### "\n \ | ||
echo " ### ### "\n \ | ||
echo " ### FOR MORE INFORMATION GOTO ### "\n \ | ||
echo " ### https://github.com/pglombardo/PasswordPusher ### "\n \ | ||
echo " ### !!DEPRECATION NOTIFICATION!! ### "\n \ | ||
echo " ########################################################################## "\n \ | ||
' ./containers/docker/pwpush/entrypoint.sh | ||
|
||
# Setting database backend | ||
ENV DATABASE_URL=mysql2://passwordpusher_user:passwordpusher_passwd@mysql:3306/passwordpusher_db |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,70 +1,22 @@ | ||
# pwpush-postgres | ||
FROM ruby:3.2-alpine AS build-env | ||
|
||
LABEL maintainer='[email protected]' | ||
|
||
# Required packages | ||
RUN apk upgrade --no-cache \ | ||
&& apk add --no-cache build-base git curl tzdata zlib-dev nodejs yarn libc6-compat libpq-dev | ||
|
||
ENV APP_ROOT=/opt/PasswordPusher PATH=${APP_ROOT}:${PATH} HOME=${APP_ROOT} | ||
|
||
RUN mkdir -p ${APP_ROOT} | ||
COPY ./ ${APP_ROOT}/ | ||
|
||
WORKDIR ${APP_ROOT} | ||
|
||
# Setting DATABASE_URL is necessary for building. | ||
ENV DATABASE_URL=postgres://passwordpusher_user:passwordpusher_passwd@postgres:5432/passwordpusher_db | ||
|
||
RUN gem install bundler | ||
|
||
ENV RACK_ENV=production RAILS_ENV=production RAILS_SERVE_STATIC_FILES=true | ||
|
||
RUN bundle config set without 'development private test' \ | ||
&& bundle config set with 'postgres' \ | ||
&& bundle config set deployment 'true' \ | ||
&& bundle install \ | ||
&& yarn install | ||
|
||
RUN bundle exec rails assets:precompile | ||
|
||
# Removing unneccesary files/directories | ||
RUN rm -rf node_modules tmp/cache vendor/assets spec \ | ||
&& rm -rf vendor/bundle/ruby/*/cache/*.gem \ | ||
&& find vendor/bundle/ruby/*/gems/ -name "*.c" -delete \ | ||
&& find vendor/bundle/ruby/*/gems/ -name "*.o" -delete | ||
|
||
################## Build done ################## | ||
|
||
FROM ruby:3.2-alpine | ||
|
||
LABEL maintainer='[email protected]' | ||
|
||
# install packages | ||
RUN apk upgrade --no-cache \ | ||
&& apk add --no-cache tzdata bash nodejs libc6-compat libpq | ||
|
||
# Create a user and group to run the application | ||
ARG UID=1000 | ||
ARG GID=1000 | ||
|
||
RUN addgroup -g "${GID}" pwpusher \ | ||
&& adduser -D -u "${UID}" -G pwpusher pwpusher | ||
|
||
ENV LC_CTYPE=UTF-8 LC_ALL=en_US.UTF-8 | ||
ENV APP_ROOT=/opt/PasswordPusher PATH=${APP_ROOT}:${PATH} HOME=${APP_ROOT} | ||
WORKDIR ${APP_ROOT} | ||
ENV RACK_ENV=production RAILS_ENV=production RAILS_SERVE_STATIC_FILES=true | ||
|
||
RUN mkdir -p ${APP_ROOT} && chown -R pwpusher:pwpusher ${APP_ROOT} | ||
COPY --from=build-env --chown=pwpusher:pwpusher ${APP_ROOT} ${APP_ROOT} | ||
|
||
ENV DATABASE_URL=postgres://passwordpusher_user:passwordpusher_passwd@postgres:5432/passwordpusher_db | ||
RUN bundle config set without 'development private test' \ | ||
&& bundle config set with 'postgres' \ | ||
&& bundle config set deployment 'true' | ||
|
||
USER pwpusher | ||
EXPOSE 5100 | ||
ENTRYPOINT ["containers/docker/pwpush-postgres/entrypoint.sh"] | ||
# Using universal image as a base for old non universal image | ||
# this is for the transition phase since these old image will become obsolete | ||
ARG BASEIMAGE=pwpush:latest | ||
FROM $BASEIMAGE | ||
|
||
# Insert decrecation note to inform users while spinning up containers | ||
RUN sed -i '5 a \ | ||
echo " ########################################################################## "\n \ | ||
echo " ### !!DEPRECATION NOTIFICATION!! ### "\n \ | ||
echo " ### THIS IMAGE IS DEPRECATED. SUPPORT FOR THIS IMAGE WILL BE DROPPED ### "\n \ | ||
echo " ### IN THE NEAR FUTURE. PLEASE MIGRATE TO THE NEW IMAGE ### "\n \ | ||
echo " ### ### "\n \ | ||
echo " ### FOR MORE INFORMATION GOTO ### "\n \ | ||
echo " ### https://github.com/pglombardo/PasswordPusher ### "\n \ | ||
echo " ### !!DEPRECATION NOTIFICATION!! ### "\n \ | ||
echo " ########################################################################## "\n \ | ||
' ./containers/docker/pwpush/entrypoint.sh | ||
|
||
# Setting database backend | ||
ENV DATABASE_URL=postgres://passwordpusher_user:passwordpusher_passwd@postgres:5432/passwordpusher_db |
Oops, something went wrong.