Skip to content

Commit cae999e

Browse files
authored
Dockerfile created
1 parent 2918bb7 commit cae999e

File tree

4 files changed

+80
-0
lines changed

4 files changed

+80
-0
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Publish Docker Image
2+
3+
on:
4+
release:
5+
types: [ published ]
6+
7+
env:
8+
# GitHub repository is basically "$org/$repo"
9+
IMAGE_NAME: ${{ github.repository }}
10+
11+
jobs:
12+
build-and-push-image:
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: read
16+
packages: write
17+
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v2
21+
22+
# User triggering the action is authenticated to the container registry
23+
- name: Log in to the Container registry
24+
uses: docker/login-action@v1.10.0
25+
with:
26+
registry: ghcr.io
27+
username: ${{ github.actor }}
28+
password: ${{ secrets.GITHUB_TOKEN }}
29+
30+
# Basically sets the image tag from the release
31+
- name: Extract metadata for Docker
32+
id: meta
33+
uses: docker/metadata-action@v3.6.0
34+
with:
35+
images: ghcr.io/${{ env.IMAGE_NAME }}
36+
37+
- name: Build and push Docker image
38+
uses: docker/build-push-action@v2.7.0
39+
with:
40+
context: .
41+
push: true
42+
tags: ${{ steps.meta.outputs.tags }}
43+
labels: ${{ steps.meta.outputs.labels }}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: Build Docker image.
2+
3+
on:
4+
pull_request:
5+
branches: [ main ]
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout code
12+
uses: actions/checkout@v2
13+
- name: Build the Docker image
14+
run: docker build . --file Dockerfile

Dockerfile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
FROM haskell:8.10 AS build
2+
RUN mkdir -p /app/user
3+
WORKDIR /app/user
4+
COPY stack.yaml *.cabal ./
5+
6+
RUN export PATH=$(stack path --local-bin):$PATH
7+
RUN stack build --dependencies-only
8+
9+
COPY . /app/user
10+
RUN stack install
11+
12+
FROM ubuntu:latest AS exec
13+
ENV LANG C.UTF-8
14+
CMD /root/.local/bin/mat-chalmers
15+
EXPOSE 5007

docker-compose.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
version: '3.7'
2+
3+
services:
4+
mat:
5+
build: .
6+
restart: unless-stopped
7+
ports:
8+
- "5007:5007"

0 commit comments

Comments
 (0)