Build/push runtime image using Github Actions

This commit is contained in:
Michael Snoyman 2020-04-05 15:38:33 +03:00
parent dcc4ec7213
commit 6afbf09892
No known key found for this signature in database
GPG Key ID: 907EAE2F42B52046
4 changed files with 14 additions and 15 deletions

View File

@ -20,8 +20,8 @@ jobs:
- name: Push to Docker Hub
run: |
echo "${{ secrets.DOCKER_HUB_TOKEN }}" | docker login --username snoyberg --password-stdin
IMAGE_ID=snoyberg/snoyman.com
echo "${{ secrets.DOCKER_HUB_TOKEN }}" | docker login --username fpcojenkins --password-stdin
IMAGE_ID=fpco/stackage-server-prod
docker tag image $IMAGE_ID
docker push $IMAGE_ID
IMAGE_ID=$IMAGE_ID:$GITHUB_SHA

12
Dockerfile Normal file
View File

@ -0,0 +1,12 @@
FROM docker.pkg.github.com/fpco/stackage-server/base-build:dcc4ec7213daed35b27629b894c06a9769b9acff as build-app
RUN mkdir -p /artifacts/bin
COPY . /src
RUN stack install --stack-yaml /src/stack.yaml --local-bin-path /artifacts/bin
FROM docker.pkg.github.com/fpco/stackage-server/base-run:dcc4ec7213daed35b27629b894c06a9769b9acff
COPY --from=build-app /src/config/ /app/config/
COPY --from=build-app /src/static/ /app/static/
COPY --from=build-app /artifacts/bin/stackage-server /usr/local/bin/stackage-server
COPY --from=build-app /artifacts/bin/stackage-server-cron /usr/local/bin/stackage-server-cron

View File

@ -1 +0,0 @@
/_artifacts/

View File

@ -1,12 +0,0 @@
#fpco/stack-run:lts-5
FROM fpco/stack-run@sha256:4b170ac899755a89c0295b7726c5530015211055125f6e3f6c5b902cb3e9b74b
RUN export DEBIAN_FRONTEND=noninteractive && \
apt-get update && \
wget -qO- https://get.haskellstack.org/ | sh -x && \
unset DEBIAN_FRONTEND
COPY _artifacts/config/ /app/config/
COPY _artifacts/static/ /app/static/
COPY _artifacts/stackage-server /usr/local/bin/stackage-server
COPY _artifacts/stackage-server-cron /usr/local/bin/stackage-server-cron