-
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.
Merge branch 'dev-infrastructure' into spike/dev-security-updates
- Loading branch information
Showing
35 changed files
with
1,296 additions
and
250 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,11 @@ | ||
.dockerignore | ||
.git/ | ||
.github/ | ||
.gitignore | ||
.vs | ||
.vscode | ||
CHANGELOG.md | ||
README.md | ||
log/ | ||
|
||
public/assets/ |
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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: "Build & Publish Docker Image" | ||
on: | ||
workflow_dispatch: {} | ||
push: {} | ||
|
||
jobs: | ||
publish: | ||
uses: "epimorphics/github-workflows/.github/workflows/publish.yml@reusable" | ||
secrets: | ||
# Repostory specific | ||
aws_access_key_id: "${{ secrets.BUILD_HMLR_AWS_ACCESS_KEY_ID }}" | ||
aws_secret_access_key: "${{ secrets.BUILD_HMLR_AWS_SECRET_ACCESS_KEY }}" | ||
# Fixed | ||
epi_gpr_access_token: "${{ secrets.HMLR_GPR_ACCESS_TOKEN }}" | ||
deploy: | ||
needs: "publish" | ||
uses: "epimorphics/github-workflows/.github/workflows/deploy.yml@reusable" | ||
with: | ||
# Repostory specific | ||
ansible_repo: epimorphics/hmlr-ansible-deployment | ||
ansible_repo_ref: master | ||
host_prefix: hmlr | ||
# Fixed | ||
deploy: "${{ needs.publish.outputs.deploy }}" | ||
key: "${{ needs.publish.outputs.key }}" | ||
tag: "${{ needs.publish.outputs.tag }}" | ||
secrets: | ||
# Repostory specific | ||
ansible_vault_password: "${{ secrets.HMLR_ANSIBLE_VAULT_PASSWORD }}" | ||
aws_access_key_id: "${{ secrets.BUILD_HMLR_AWS_ACCESS_KEY_ID }}" | ||
aws_secret_access_key: "${{ secrets.BUILD_HMLR_AWS_SECRET_ACCESS_KEY }}" | ||
ssh_key: "${{ secrets.HMLR_SSH_KEY }}" | ||
# Fixed | ||
github_pat: "${{ secrets.GIT_REPOSITORY_FULL_ACCESS_PAT }}" |
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
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 |
---|---|---|
@@ -0,0 +1,69 @@ | ||
ARG ALPINE_VERSION | ||
ARG RUBY_VERSION | ||
|
||
# Defines base image which builder and final stage use | ||
FROM ruby:${RUBY_VERSION}-alpine${ALPINE_VERSION} as base | ||
ARG BUNDLER_VERSION | ||
|
||
|
||
RUN apk add --update \ | ||
bash \ | ||
coreutils \ | ||
git \ | ||
nodejs \ | ||
tzdata \ | ||
&& rm -rf /var/cache/apk/* \ | ||
&& gem install bundler:$BUNDLER_VERSION \ | ||
&& bundle config --global frozen 1 | ||
|
||
FROM base as builder | ||
|
||
RUN apk add --update build-base | ||
|
||
WORKDIR /usr/src/app | ||
|
||
COPY config.ru Gemfile Gemfile.lock Rakefile ./ | ||
COPY .bundle/config /root/.bundle/config | ||
COPY bin bin | ||
|
||
RUN ./bin/bundle config set --local without 'development test' && ./bin/bundle install && mkdir log | ||
|
||
COPY app app | ||
COPY config config | ||
COPY public public | ||
|
||
# Compile | ||
|
||
RUN RAILS_ENV=production \ | ||
# RAILS_RELATIVE_URL_ROOT=/ \ | ||
bundle exec rake assets:precompile \ | ||
&& mkdir -m 777 /usr/src/app/coverage | ||
|
||
# Start a new build stage to minimise the final image size | ||
FROM base | ||
|
||
ARG image_name | ||
ARG git_branch | ||
ARG git_commit_hash | ||
ARG github_run_number | ||
ARG VERSION | ||
|
||
LABEL com.epimorphics.name=$image_name \ | ||
com.epimorphics.branch=$git_branch \ | ||
com.epimorphics.build=$github_run_number \ | ||
com.epimorphics.commit=$git_commit_hash \ | ||
com.epimorphics.version=$VERSION | ||
|
||
RUN addgroup -S app && adduser -S -G app app | ||
EXPOSE 3000 | ||
|
||
WORKDIR /usr/src/app | ||
|
||
COPY --from=builder --chown=app /usr/local/bundle /usr/local/bundle | ||
COPY --from=builder --chown=app /usr/src/app . | ||
|
||
USER app | ||
|
||
# Add a script to be executed every time the container starts. | ||
COPY entrypoint.sh "/app/entrypoint.sh" | ||
ENTRYPOINT ["sh", "/app/entrypoint.sh"] |
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.