Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build_base_image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ jobs:

build:

runs-on: ubuntu-20.04
runs-on: ubuntu-22.04

steps:

- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Get versions
shell: python
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/run-automatest-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ on: [push]

jobs:
test:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2.0.0
- uses: actions/checkout@v3

- name: Build image for tests
run: docker build -t proxy-tester -f Dockerfile.test .
Expand All @@ -15,19 +15,19 @@ jobs:
run: docker run -d --name tester proxy-tester

- name: Install rebar dependencies
run: docker exec -i tester rebar3 as test get-deps
run: docker exec -i tester bash -l -c "source /root/.asdf/asdf.sh && rebar3 as test get-deps"

- name: Integrated Ruby app setup
run: docker exec -d tester bash -l -c "cd apps/epp_proxy/priv/test_backend_app && bundle install && bundle exec rackup"

- name: Compile for tests
run: |
sleep 15
docker exec -i tester rebar3 as test compile
docker exec -i tester bash -l -c "source /root/.asdf/asdf.sh && rebar3 as test compile"

- name: Run tests
run: |
docker exec -i -e DEBUG=1 tester rebar3 ct --sys_config config/test.config --readable=false --cover --verbose=true
docker exec -i -e DEBUG=1 tester bash -l -c "source /root/.asdf/asdf.sh && rebar3 ct --sys_config config/test.config --readable=false --cover --verbose=true"

- name: Show test coverage
run: docker exec -i tester rebar3 cover --verbose
run: docker exec -i tester bash -l -c "source /root/.asdf/asdf.sh && rebar3 cover --verbose"
6 changes: 3 additions & 3 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
erlang 21.3.8
ruby 2.6.3
rebar 3.11.0
erlang 23.3.4.20
ruby 3.2.2
rebar 3.15.2
70 changes: 37 additions & 33 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,44 +1,48 @@
FROM debian:buster-slim
FROM debian:bullseye-slim

SHELL ["/bin/bash", "-o", "pipefail", "-c"]
COPY ./docker/apt/sources.list /etc/apt/

RUN apt-get update && apt-get -t buster install -y -qq wget \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*


RUN apt-get update && apt-get install -y -qq git \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

RUN apt-get update && apt-get install -y \
build-essential=* \
libncurses5-dev=* \
automake=* \
autoconf=* \
curl=* \
ca-certificates=* \
libssl-dev=* \
libreadline-dev=* \
libdpkg-perl=* \
liberror-perl=* \
libc6=* \
# Install all dependencies in a single layer to reduce image size
RUN apt-get update && apt-get install -y -qq \
wget \
git \
build-essential \
libncurses5-dev \
automake \
autoconf \
curl \
ca-certificates \
libssl-dev \
libreadline-dev \
libdpkg-perl \
liberror-perl \
libc6 \
libc-dev \
perl=* \
procps=* \
inotify-tools=* \
libssl1.1=* \
perl-base=* \
perl \
procps \
inotify-tools \
libssl1.1 \
perl-base \
zlib1g-dev \
# Additional dependencies for Erlang build
libncurses-dev \
libsctp-dev \
# Documentation tools to prevent build failures
xsltproc \
libxml2-utils \
# Dependencies for Ruby 3.2.2
libffi-dev \
libyaml-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

# RUN (groupadd -g 999 asdf || true)
# RUN (adduser --shell /bin/bash --home /asdf --disabled-password -gid 999 -u 999 asdf || true)
# ENV PATH="${PATH}:/asdf/.asdf/shims:/asdf/.asdf/bin"
# USER asdf
# WORKDIR /asdf
# Set environment variables for Erlang build
ENV KERL_CONFIGURE_OPTIONS="--disable-debug --without-javac --without-wx --without-odbc --disable-hipe --without-jinterface --without-docs"
ENV KERL_BUILD_DOCS="no"
ENV KERL_DOC_TARGETS=""
ENV KERL_INSTALL_HTMLDOCS="no"
ENV KERL_INSTALL_MANPAGES="no"

RUN git clone https://github.com/asdf-vm/asdf.git --branch v0.6.3 "$HOME"/.asdf && \
echo '. $HOME/.asdf/asdf.sh' >> "$HOME"/.bashrc && \
Expand All @@ -51,7 +55,7 @@ WORKDIR /opt/erlang/epp_proxy

COPY .tool-versions ./
RUN asdf plugin-add erlang
RUN asdf install
RUN . $HOME/.asdf/asdf.sh && asdf install
RUN asdf global erlang $(grep erlang .tool-versions | cut -d' ' -f2)
RUN asdf plugin-add ruby
RUN asdf plugin-add rebar
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.Erlang-ruby.base
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM debian:buster-slim
FROM debian:bullseye-slim

RUN apt-get update && apt-get install -y \
wget \
Expand Down
58 changes: 58 additions & 0 deletions Dockerfile.amd64.legacy
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
FROM debian:buster-slim

SHELL ["/bin/bash", "-o", "pipefail", "-c"]
COPY ./docker/apt/sources.list /etc/apt/

RUN apt-get update && apt-get -t buster install -y -qq wget \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*


RUN apt-get update && apt-get install -y -qq git \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

RUN apt-get update && apt-get install -y \
build-essential=* \
libncurses5-dev=* \
automake=* \
autoconf=* \
curl=* \
ca-certificates=* \
libssl-dev=* \
libreadline-dev=* \
libdpkg-perl=* \
liberror-perl=* \
libc6=* \
libc-dev \
perl=* \
procps=* \
inotify-tools=* \
libssl1.1=* \
perl-base=* \
zlib1g-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

# RUN (groupadd -g 999 asdf || true)
# RUN (adduser --shell /bin/bash --home /asdf --disabled-password -gid 999 -u 999 asdf || true)
# ENV PATH="${PATH}:/asdf/.asdf/shims:/asdf/.asdf/bin"
# USER asdf
# WORKDIR /asdf

RUN git clone https://github.com/asdf-vm/asdf.git --branch v0.6.3 "$HOME"/.asdf && \
echo '. $HOME/.asdf/asdf.sh' >> "$HOME"/.bashrc && \
echo '. $HOME/.asdf/asdf.sh' >> "$HOME"/.profile

ENV PATH="${PATH}:/root/.asdf/shims:/root/.asdf/bin"

RUN mkdir -p /opt/erlang/epp_proxy
WORKDIR /opt/erlang/epp_proxy

COPY .tool-versions ./
RUN asdf plugin-add erlang
RUN asdf install
RUN asdf global erlang $(grep erlang .tool-versions | cut -d' ' -f2)
RUN asdf plugin-add ruby
RUN asdf plugin-add rebar
RUN asdf install
105 changes: 105 additions & 0 deletions Dockerfile.k8s
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
FROM debian:bullseye-slim AS build

SHELL ["/bin/bash", "-o", "pipefail", "-c"]
COPY ./docker/apt/sources.list /etc/apt/

# Install build dependencies
RUN apt-get update && apt-get install -y -qq \
wget \
git \
build-essential \
libncurses5-dev \
automake \
autoconf \
curl \
ca-certificates \
libssl-dev \
libreadline-dev \
libdpkg-perl \
liberror-perl \
libc6 \
libc-dev \
perl \
procps \
inotify-tools \
libssl1.1 \
perl-base \
zlib1g-dev \
libncurses-dev \
libsctp-dev \
xsltproc \
libxml2-utils \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

# Set environment variables for Erlang build
ENV KERL_CONFIGURE_OPTIONS="--disable-debug --without-javac --without-wx --without-odbc --disable-hipe --without-jinterface --without-docs"
ENV KERL_BUILD_DOCS="no"
ENV KERL_DOC_TARGETS=""
ENV KERL_INSTALL_HTMLDOCS="no"
ENV KERL_INSTALL_MANPAGES="no"

RUN git clone https://github.com/asdf-vm/asdf.git --branch v0.6.3 "$HOME"/.asdf && \
echo '. $HOME/.asdf/asdf.sh' >> "$HOME"/.bashrc && \
echo '. $HOME/.asdf/asdf.sh' >> "$HOME"/.profile

ENV PATH="${PATH}:/root/.asdf/shims:/root/.asdf/bin"

RUN mkdir -p /opt/erlang/epp_proxy
WORKDIR /opt/erlang/epp_proxy

COPY .tool-versions ./
RUN asdf plugin-add erlang
RUN ERLANG_VERSION=$(grep erlang .tool-versions | cut -d' ' -f2) && \
. $HOME/.asdf/asdf.sh && asdf install erlang $ERLANG_VERSION
RUN asdf global erlang $(grep erlang .tool-versions | cut -d' ' -f2)
RUN asdf plugin-add rebar
RUN REBAR_VERSION=$(grep rebar .tool-versions | cut -d' ' -f2) && \
. $HOME/.asdf/asdf.sh && asdf install rebar $REBAR_VERSION
RUN asdf global rebar $(grep rebar .tool-versions | cut -d' ' -f2)

# Copy application files
COPY rebar.config rebar.lock ./
COPY config ./config
COPY apps ./apps

# Build the release
RUN . $HOME/.asdf/asdf.sh && rebar3 as prod release

# Second stage: runtime image
FROM debian:bullseye-slim

# Install runtime dependencies only
RUN apt-get update && apt-get install -y -qq \
libssl1.1 \
libncurses6 \
libsctp1 \
procps \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

# Create app directory
RUN mkdir -p /opt/erlang/epp_proxy
WORKDIR /opt/erlang/epp_proxy

# Copy the release from the build stage
COPY --from=build /opt/erlang/epp_proxy/_build/prod/rel/epp_proxy ./

# Create a non-root user to run the application
RUN groupadd -r epp && useradd -r -g epp epp
RUN chown -R epp:epp /opt/erlang/epp_proxy
USER epp

# Expose the EPP port
EXPOSE 700

# Set environment variables
ENV RELX_REPLACE_OS_VARS=true
ENV NODE_NAME=epp_proxy@127.0.0.1

# Health check
# HEALTHCHECK --interval=30s --timeout=5s --start-period=5s --retries=3 \
# CMD ps aux | grep "beam" | grep -v grep || exit 1

# Command to run the application
CMD ["./bin/epp_proxy", "foreground"]
File renamed without changes.
68 changes: 66 additions & 2 deletions Dockerfile.test
Original file line number Diff line number Diff line change
@@ -1,4 +1,68 @@
FROM internetee/erlang-ruby:21.3.8-2.6.3
FROM debian:bullseye-slim

SHELL ["/bin/bash", "-o", "pipefail", "-c"]
COPY ./docker/apt/sources.list /etc/apt/

# Install all dependencies in a single layer to reduce image size
RUN apt-get update && apt-get install -y -qq \
wget \
git \
build-essential \
libncurses5-dev \
automake \
autoconf \
curl \
ca-certificates \
libssl-dev \
libreadline-dev \
libdpkg-perl \
liberror-perl \
libc6 \
libc-dev \
perl \
procps \
inotify-tools \
libssl1.1 \
perl-base \
zlib1g-dev \
# Additional dependencies for Erlang build
libncurses-dev \
libsctp-dev \
# Documentation tools to prevent build failures
xsltproc \
libxml2-utils \
# Dependencies for Ruby 3.2.2
libffi-dev \
libyaml-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

# Set environment variables for Erlang build
ENV KERL_CONFIGURE_OPTIONS="--disable-debug --without-javac --without-wx --without-odbc --disable-hipe --without-jinterface --without-docs"
ENV KERL_BUILD_DOCS="no"
ENV KERL_DOC_TARGETS=""
ENV KERL_INSTALL_HTMLDOCS="no"
ENV KERL_INSTALL_MANPAGES="no"

RUN git clone https://github.com/asdf-vm/asdf.git --branch v0.6.3 "$HOME"/.asdf && \
echo '. $HOME/.asdf/asdf.sh' >> "$HOME"/.bashrc && \
echo '. $HOME/.asdf/asdf.sh' >> "$HOME"/.profile

ENV PATH="${PATH}:/root/.asdf/shims:/root/.asdf/bin"

RUN mkdir -p /opt/erlang/epp_proxy
WORKDIR /opt/erlang/epp_proxy

COPY .tool-versions ./
RUN asdf plugin-add erlang
RUN . $HOME/.asdf/asdf.sh && asdf install
RUN asdf global erlang $(grep erlang .tool-versions | cut -d' ' -f2)
RUN asdf plugin-add ruby
RUN asdf plugin-add rebar
RUN asdf install

# Copy the application code
COPY . .

CMD ["tail", "-f" , "/dev/null"]
# Keep container running for tests
CMD ["tail", "-f", "/dev/null"]
Loading