File tree Expand file tree Collapse file tree 4 files changed +90
-8
lines changed Expand file tree Collapse file tree 4 files changed +90
-8
lines changed Original file line number Diff line number Diff line change 1
1
/.git
2
+ /.github
2
3
/deployment
3
4
. * .swp
Original file line number Diff line number Diff line change
1
+ name : Build the ruby gem in a container
2
+ on :
3
+ pull_request :
4
+
5
+ jobs :
6
+ build-ruby-gem :
7
+ runs-on : ubuntu-latest
8
+ steps :
9
+ - name : Checkout project code
10
+ uses : actions/checkout@v4
11
+
12
+ - name : Setup Docker builder
13
+ uses : docker/setup-buildx-action@v3
14
+
15
+ - name : Build container for build target
16
+ uses : docker/build-push-action@v5
17
+ with :
18
+ context : .
19
+ file : ./deployment/Containerfile
20
+ target : build
21
+ push : false
22
+ load : true
23
+ tags : linuxfrorg/board-sse-linuxfr.org:${{ github.sha }}
24
+ cache-from : type=gha
25
+ cache-to : type=gha,mode=max
Original file line number Diff line number Diff line change
1
+ name : Build the ruby gem in a container and publish it on Github Package Repository
2
+ on :
3
+ release :
4
+ types :
5
+ - published
6
+
7
+ jobs :
8
+ build-ruby-gem :
9
+ runs-on : ubuntu-latest
10
+ steps :
11
+ - name : Checkout project code
12
+ uses : actions/checkout@v4
13
+
14
+ - name : Setup Docker builder
15
+ uses : docker/setup-buildx-action@v3
16
+
17
+ - name : Build container for build target
18
+ uses : docker/build-push-action@v5
19
+ with :
20
+ context : .
21
+ file : ./deployment/Containerfile
22
+ target : build
23
+ push : false
24
+ load : true
25
+ tags : linuxfrorg/board-sse-linuxfr.org:${{ github.sha }}
26
+ cache-from : type=gha
27
+ cache-to : type=gha,mode=max
28
+
29
+ - name : Publish gem to Github Package Repository
30
+ uses : addnab/docker-run-action@v3
31
+ env :
32
+ GEM_HOST_API_KEY : " Bearer ${{secrets.GITHUB_TOKEN}}"
33
+ OWNER : ${{ github.repository_owner }}
34
+ with :
35
+ image : linuxfrorg/board-sse-linuxfr.org:${{ github.sha }}
36
+ options : >-
37
+ -e OWNER
38
+ -e GEM_HOST_API_KEY
39
+ run : |
40
+ set -eux
41
+ IFS=$'\n\t'
42
+
43
+ mkdir -p "${HOME}/.gem"
44
+ touch "${HOME}/.gem/credentials"
45
+ chmod 0600 "${HOME}/.gem/credentials"
46
+ printf -- "---\n:github: ${GEM_HOST_API_KEY}\n" > "${HOME}/.gem/credentials"
47
+ gem push --KEY github --host "https://rubygems.pkg.github.com/${OWNER}" *.gem
Original file line number Diff line number Diff line change 1
- FROM ruby:3-slim-bookworm
1
+ FROM ruby:3-slim-bookworm AS build
2
2
3
3
LABEL org.opencontainers.image.title="LinuxFr.org boards"
4
4
LABEL org.opencontainers.image.description="Chat rooms for LinuxFr"
@@ -10,20 +10,29 @@ LABEL org.opencontainers.image.authors="Adrien Dorsaz <
[email protected] >"
10
10
11
11
ARG UID=1200
12
12
13
- RUN apt-get update \
14
- # Install dependencies \
15
- && apt-get install -y --no-install-recommends \
16
- build-essential ruby ruby-dev \
17
- && apt-get clean
13
+ RUN <<EOF
14
+ set -eux
15
+ IFS=$'\n\t '
16
+
17
+ apt-get update
18
+
19
+ apt-get install -y --no-install-recommends \
20
+ build-essential ruby ruby-dev
21
+
22
+ apt-get clean
23
+ EOF
18
24
19
25
USER ${UID}
20
26
WORKDIR /linuxfr-board
21
27
ENV HOME=/linuxfr-board
22
28
23
29
# Install board-linuxfr
24
30
COPY --chown=${UID}:0 --chmod=770 . .
25
- RUN gem build board-linuxfr.gemspec \
26
- && gem install ./board-linuxfr-*.gem
31
+ RUN gem build board-linuxfr.gemspec
32
+
33
+ FROM build as productioproduction
34
+
35
+ RUN gem install ./board-linuxfr-*.gem
27
36
28
37
# Clean development dependencies
29
38
USER 0
You can’t perform that action at this time.
0 commit comments