-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
502 additions
and
171 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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
.git | ||
tmp | ||
!tmp/pids | ||
log | ||
public/assets | ||
public/packs | ||
.bundle | ||
|
||
db/*.sqlite3 | ||
db/*.sqlite3-* | ||
|
||
storage | ||
config/master.key | ||
config/credentials/*.key | ||
|
||
node_modules |
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
name: Fly Staging Deployment | ||
on: | ||
push: | ||
branches: | ||
- develop | ||
env: | ||
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} | ||
jobs: | ||
deploy: | ||
name: Deploy app | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: superfly/flyctl-actions/setup-flyctl@master | ||
- run: flyctl deploy --config fly.staging.toml --dockerfile Dockerfile.staging --remote-only |
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 |
---|---|---|
@@ -0,0 +1,97 @@ | ||
# syntax = docker/dockerfile:experimental | ||
ARG RUBY_VERSION=2.7.3 | ||
ARG VARIANT=jemalloc-slim | ||
FROM quay.io/evl.ms/fullstaq-ruby:${RUBY_VERSION}-${VARIANT} as base | ||
|
||
ARG NODE_VERSION=16 | ||
ARG BUNDLER_VERSION=2.3.9 | ||
|
||
ARG RAILS_ENV=production | ||
ENV RAILS_ENV=${RAILS_ENV} | ||
|
||
ENV RAILS_SERVE_STATIC_FILES true | ||
ENV RAILS_LOG_TO_STDOUT true | ||
|
||
ARG BUNDLE_WITHOUT=development:test | ||
ARG BUNDLE_PATH=vendor/bundle | ||
ENV BUNDLE_PATH ${BUNDLE_PATH} | ||
ENV BUNDLE_WITHOUT ${BUNDLE_WITHOUT} | ||
|
||
RUN mkdir /app | ||
WORKDIR /app | ||
RUN mkdir -p tmp/pids | ||
|
||
SHELL ["/bin/bash", "-c"] | ||
|
||
RUN curl https://get.volta.sh | bash | ||
|
||
ENV BASH_ENV ~/.bashrc | ||
ENV VOLTA_HOME /root/.volta | ||
ENV PATH $VOLTA_HOME/bin:/usr/local/bin:$PATH | ||
|
||
RUN volta install node@${NODE_VERSION} && volta install yarn | ||
|
||
FROM base as build_deps | ||
|
||
ARG DEV_PACKAGES="git build-essential libpq-dev wget vim curl gzip xz-utils libsqlite3-dev" | ||
ENV DEV_PACKAGES ${DEV_PACKAGES} | ||
|
||
RUN --mount=type=cache,id=dev-apt-cache,sharing=locked,target=/var/cache/apt \ | ||
--mount=type=cache,id=dev-apt-lib,sharing=locked,target=/var/lib/apt \ | ||
apt-get update -qq && \ | ||
apt-get install --no-install-recommends -y ${DEV_PACKAGES} \ | ||
&& rm -rf /var/lib/apt/lists /var/cache/apt/archives | ||
|
||
FROM build_deps as gems | ||
|
||
RUN gem update --system --no-document && \ | ||
gem install -N bundler -v ${BUNDLER_VERSION} | ||
|
||
COPY Gemfile* ./ | ||
RUN bundle install && rm -rf vendor/bundle/ruby/*/cache | ||
|
||
FROM build_deps as node_modules | ||
|
||
COPY package*json ./ | ||
COPY yarn.* ./ | ||
|
||
RUN yarn install | ||
|
||
FROM base | ||
|
||
ARG PROD_PACKAGES="postgresql-client file vim curl gzip libsqlite3-0" | ||
ENV PROD_PACKAGES=${PROD_PACKAGES} | ||
|
||
RUN --mount=type=cache,id=prod-apt-cache,sharing=locked,target=/var/cache/apt \ | ||
--mount=type=cache,id=prod-apt-lib,sharing=locked,target=/var/lib/apt \ | ||
apt-get update -qq && \ | ||
apt-get install --no-install-recommends -y \ | ||
${PROD_PACKAGES} \ | ||
&& rm -rf /var/lib/apt/lists /var/cache/apt/archives | ||
|
||
COPY --from=gems /app /app | ||
COPY --from=node_modules /app/node_modules /app/node_modules | ||
COPY --from=gems /usr/lib/fullstaq-ruby/versions /usr/lib/fullstaq-ruby/versions | ||
COPY --from=gems /usr/local/bundle /usr/local/bundle | ||
|
||
# The following enable assets to precompile on the build server. Adjust | ||
# as necessary. If no combination works for you, see: | ||
# https://fly.io/docs/rails/getting-started/existing/#access-to-environment-variables-at-build-time | ||
ENV SECRET_KEY_BASE 1 | ||
# ENV AWS_ACCESS_KEY_ID=1 | ||
# ENV AWS_SECRET_ACCESS_KEY=1 | ||
ENV APP_BASE_URL = "https://miru-staging.fly.dev" | ||
|
||
COPY . . | ||
|
||
RUN chmod +x /app/bin/* && \ | ||
sed -i 's/ruby.exe/ruby/' /app/bin/* && \ | ||
sed -i '/^#!/aDir.chdir File.expand_path("..", __dir__)' /app/bin/* | ||
|
||
RUN bin/rails fly:build | ||
|
||
ENV PORT 8080 | ||
|
||
ARG SERVER_COMMAND="bin/rails fly:server" | ||
ENV SERVER_COMMAND ${SERVER_COMMAND} | ||
CMD ${SERVER_COMMAND} |
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
Oops, something went wrong.