-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update dockerfile and actions #732
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
3a183bb
Update dockerfile and actions
PaulJKim 0f13f75
Add docker.yml
PaulJKim d98ece6
Update mix.exs
PaulJKim 8c951d9
use v2
PaulJKim 2b67400
add permissions
PaulJKim f969b2d
use snake case
PaulJKim 3023481
kebab case
PaulJKim 123ba1b
Add needed permissions to dev and prod workflows
PaulJKim dbe5976
default to instance role
PaulJKim File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,35 +1,38 @@ | ||
name: Deploy to Dev-green | ||
name: Deploy to Dev Green | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: [main] | ||
|
||
jobs: | ||
Build: | ||
runs-on: windows-2019 | ||
deploy: | ||
name: Deploy | ||
runs-on: ubuntu-latest | ||
permissions: | ||
id-token: write | ||
contents: read | ||
contents: read | ||
environment: dev-green-linux | ||
concurrency: dev-green-linux | ||
env: | ||
ECS_CLUSTER: linux-staging | ||
ECS_SERVICE: realtime-signs-dev-green | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
- uses: actions/checkout@v3 | ||
- uses: mbta/actions/build-push-ecr@v2 | ||
id: build-push | ||
with: | ||
role-to-assume: ${{ secrets.AWS_ROLE_ARN }} | ||
docker-repo: ${{ secrets.DOCKER_REPO }} | ||
deploy: | ||
name: Deploy | ||
needs: build | ||
uses: mbta/workflows/.github/workflows/deploy-on-prem.yml@v2 | ||
with: | ||
app-name: realtime-signs | ||
environment: dev-green | ||
on-prem-cluster: hsctd-dev-managers | ||
splunk-index: realtime-signs-dev-green | ||
task-cpu: .5 | ||
task-memory: 2048M | ||
task-port: 8080 | ||
secrets: | ||
aws-role-arn: ${{ secrets.AWS_ROLE_ARN }} | ||
docker-repo: ${{ secrets.DOCKER_REPO }} | ||
slack-webhook: ${{ secrets.SLACK_WEBHOOK }} | ||
- uses: mbta/actions/deploy-ecs@v2 | ||
with: | ||
role-to-assume: ${{ secrets.AWS_ROLE_ARN }} | ||
ecs-cluster: ${{ env.ECS_CLUSTER }} | ||
ecs-service: ${{ env.ECS_SERVICE }} | ||
docker-tag: ${{ steps.build-push.outputs.docker-tag }} | ||
launch-type: EXTERNAL | ||
- uses: mbta/actions/notify-slack-deploy@v1 | ||
if: ${{ !cancelled() }} | ||
with: | ||
webhook-url: ${{ secrets.SLACK_WEBHOOK }} | ||
job-status: ${{ job.status }} |
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,18 @@ | ||
name: Build container | ||
|
||
on: | ||
push: | ||
branches-ignore: | ||
- master | ||
|
||
concurrency: | ||
group: docker-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
linux: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
- run: docker build . |
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,51 +1,52 @@ | ||
ARG ELIXIR_VERSION=1.14.0 | ||
ARG ERLANG_VERSION=25.0.4 | ||
ARG WINDOWS_VERSION=1809 | ||
ARG ALPINE_VERSION=3.18.0 | ||
# See also: ERTS_VERSION in the from image below | ||
|
||
ARG BUILD_IMAGE=mbtatools/windows-elixir:$ELIXIR_VERSION-erlang-$ERLANG_VERSION-windows-$WINDOWS_VERSION | ||
ARG FROM_IMAGE=mcr.microsoft.com/windows/servercore:$WINDOWS_VERSION | ||
|
||
FROM $BUILD_IMAGE as build | ||
FROM hexpm/elixir:${ELIXIR_VERSION}-erlang-${ERLANG_VERSION}-alpine-${ALPINE_VERSION} as build | ||
|
||
ENV MIX_ENV=prod | ||
|
||
# log which version of Windows we're using | ||
RUN ver | ||
RUN mkdir /realtime_signs | ||
|
||
RUN mkdir C:\realtime_signs | ||
WORKDIR /realtime_signs | ||
|
||
WORKDIR C:\\realtime_signs | ||
RUN apk add --no-cache git | ||
RUN mix local.hex --force && mix local.rebar --force | ||
|
||
COPY mix.exs mix.lock ./ | ||
RUN mix deps.get | ||
|
||
COPY config/config.exs config\\config.exs | ||
COPY config/prod.exs config\\prod.exs | ||
COPY config/config.exs config/config.exs | ||
COPY config/prod.exs config/prod.exs | ||
|
||
RUN mix deps.compile | ||
|
||
COPY lib lib | ||
COPY priv priv | ||
|
||
COPY config/runtime.exs config\\runtime.exs | ||
RUN mix release | ||
COPY config/runtime.exs config/runtime.exs | ||
RUN mix release linux | ||
|
||
# The one the elixir image was built with | ||
FROM alpine:${ALPINE_VERSION} | ||
|
||
RUN apk add --no-cache libssl1.1 dumb-init libstdc++ libgcc ncurses-libs && \ | ||
mkdir /work /realtime_signs && \ | ||
adduser -D realtime_signs && chown realtime_signs /work | ||
|
||
FROM $FROM_IMAGE | ||
ARG ERTS_VERSION=13.0.4 | ||
COPY --from=build /realtime_signs/_build/prod/rel/linux /realtime_signs | ||
|
||
USER ContainerAdministrator | ||
COPY --from=build C:\\Erlang\\vcredist_x64.exe vcredist_x64.exe | ||
RUN .\vcredist_x64.exe /install /quiet /norestart \ | ||
&& del vcredist_x64.exe | ||
RUN chown realtime_signs /realtime_signs/lib/tzdata-*/priv /realtime_signs/lib/tzdata*/priv/* | ||
|
||
COPY --from=build C:\\realtime_signs\\_build\\prod\\rel\\realtime_signs C:\\realtime_signs | ||
# Set exposed ports | ||
ENV MIX_ENV=prod TERM=xterm LANG=C.UTF-8 \ | ||
ERL_CRASH_DUMP_SECONDS=0 RELEASE_TMP=/work | ||
|
||
WORKDIR C:\\realtime_signs | ||
USER realtime_signs | ||
WORKDIR /work | ||
|
||
# Ensure Erlang can run | ||
RUN dir && \ | ||
erts-%ERTS_VERSION%\bin\erl -noshell -noinput +V | ||
ENTRYPOINT ["/usr/bin/dumb-init", "--"] | ||
|
||
EXPOSE 80 | ||
CMD ["C:\\realtime_signs\\bin\\realtime_signs.bat", "start"] | ||
HEALTHCHECK CMD ["/realtime_signs/bin/linux", "rpc", "1 + 1"] | ||
CMD ["/realtime_signs/bin/linux", "start"] |
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I got an error at this line; did you mean to also check in a change to
mix.exs
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yes, thank you