Skip to content

Commit

Permalink
add docker (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
imskr authored Jul 17, 2022
1 parent 64f514a commit 1ea48aa
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 26 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Readme Update Blog
on:
push:
branches:
- "main"
pull_request:
branches:
- "main"

jobs:
update-blog:
name: Update latest blogs
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Fetch medium.com posts
uses: ./
with:
rss_list: "https://imskr.medium.com/feed"
32 changes: 16 additions & 16 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
FROM golang:1.18-alpine
FROM ubuntu:latest

RUN apk add -q --update \
&& apk add -q \
bash \
git \
curl \
&& rm -rf /var/cache/apk/*
RUN apt-get update
RUN apt-get install -y wget git gcc bash

# Copy all the files from the host into the container
WORKDIR /src
COPY . .
RUN wget -P /tmp https://dl.google.com/go/go1.18.linux-amd64.tar.gz

# Enable Go modules
ENV GO111MODULE=on
RUN tar -C /usr/local -xzf /tmp/go1.18.linux-amd64.tar.gz
RUN rm /tmp/go1.18.linux-amd64.tar.gz

# Compile the action
RUN go build -o /bin/action
ENV GOPATH /go
ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH
RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 777 "$GOPATH"

# Specify the container's entrypoint as the action
ENTRYPOINT ["/bin/action"]
RUN go version

WORKDIR /app
COPY . /app/

# Start app
ENTRYPOINT ["go", "run", "/app/main.go"]
26 changes: 16 additions & 10 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,24 @@ outputs:
description: "Stringified posts in readme format"

runs:
using: "composite"
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v2
with:
go-version: '1.18'
using: "docker"
image: "Dockerfile"
args:
- "-rss_list=${{ inputs.rss_list }}"
- "-commit_user=${{ inputs.commit_user }}"
- "-commit_email=${{ inputs.commit_email }}"
- "-commit_message=${{ inputs.commit_message }}"
# steps:
# - uses: actions/checkout@v3
# - uses: actions/setup-go@v2
# with:
# go-version: '1.18'

- run: go mod tidy
shell: bash
# - run: go mod tidy
# shell: bash

- run: go run ${{ github.action_path }}/main.go
shell: bash
# - run: go run ${{ github.action_path }}/main.go
# shell: bash

branding:
icon: 'file-text'
Expand Down

0 comments on commit 1ea48aa

Please sign in to comment.