Skip to content

Commit

Permalink
Merge pull request #53 from bancolombia/feature/docker-image-user
Browse files Browse the repository at this point in the history
Feature/docker image user
  • Loading branch information
gabheadz authored Aug 1, 2023
2 parents 0137f77 + ca727c8 commit 8a87c39
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 20 deletions.
17 changes: 9 additions & 8 deletions channel-sender/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
FROM elixir:1.12-alpine as build

ARG BUILD_ENV=prod
ARG BUILD_VER=0.1.3

WORKDIR /build

Expand All @@ -21,17 +20,15 @@ RUN export MIX_ENV=${BUILD_ENV} && \
mix release channel_sender_ex

# Extract Release archive to /rel for copying in next stage
RUN RELEASE_DIR=`ls -d _build/${BUILD_ENV}/` && \
RUN RELEASE_FILE=`ls -d _build/${BUILD_ENV}/*.gz` && \
mkdir /export && \
tar -xf "${RELEASE_DIR}/channel_sender_ex-${BUILD_VER}.tar.gz" -C /export
tar -xf "${RELEASE_FILE}" -C /export

#===================
# Deployment Stage
#===================
FROM alpine:3.17

ARG BUILD_REL=channel_sender_ex

RUN apk upgrade --no-cache && \
apk add --no-cache \
ncurses-libs \
Expand All @@ -42,9 +39,13 @@ RUN apk upgrade --no-cache && \
ca-certificates \
bash

WORKDIR /app
RUN addgroup -S adfuser && adduser -S adfuser -G adfuser

WORKDIR /home/adfuser

COPY --from=build --chown=adfuser:adfuser /export/ .

COPY --from=build /export/ .
USER adfuser

ENTRYPOINT ["/app/bin/channel_sender_ex"]
ENTRYPOINT ["/home/adfuser/bin/channel_sender_ex"]
CMD ["start"]
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ spec:
spec:
containers:
- name: adfsender
image: bancolombia/async-dataflow-channel-sender:0.1.3
image: bancolombia/async-dataflow-channel-sender:0.1.4
env:
- name: POD_IP
valueFrom:
Expand Down Expand Up @@ -90,10 +90,10 @@ spec:
memory: 250M
volumeMounts:
- name: config-volume
mountPath: /app/releases/0.1.3/env.sh
mountPath: /home/adfuser/releases/0.1.4/env.sh
subPath: env.sh
- name: config-volume
mountPath: /app/releases/0.1.3/runtime.exs
mountPath: /home/adfuser/releases/0.1.4/runtime.exs
subPath: runtime.exs
volumes:
- name: config-volume
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ spec:
spec:
containers:
- name: adfsender
image: bancolombia/async-dataflow-channel-sender:0.1.3
image: bancolombia/async-dataflow-channel-sender:0.1.4
env:
- name: ERLANG_COOKIE
value: "secret"
Expand All @@ -86,10 +86,10 @@ spec:
memory: 250M
volumeMounts:
- name: config-volume
mountPath: /app/releases/0.1.3/env.sh
mountPath: /home/adfuser/releases/0.1.4/env.sh
subPath: env.sh
- name: config-volume
mountPath: /app/releases/0.1.3/runtime.exs
mountPath: /home/adfuser/releases/0.1.4/runtime.exs
subPath: runtime.exs
volumes:
- name: config-volume
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ spec:
spec:
containers:
- name: adfsender
image: bancolombia/async-dataflow-channel-sender:0.1.3
image: bancolombia/async-dataflow-channel-sender:0.1.4
env:
- name: POD_NAME
valueFrom:
Expand Down Expand Up @@ -88,12 +88,12 @@ spec:
memory: 250M
volumeMounts:
- name: config-volume
mountPath: /app/releases/0.1.3/env.sh
mountPath: /home/adfuser/releases/0.1.4/env.sh
subPath: env.sh
- name: config-volume
mountPath: /app/releases/0.1.3/runtime.exs
mountPath: /home/adfuser/releases/0.1.4/runtime.exs
subPath: runtime.exs
volumes:
- name: config-volume
configMap:
name: adfsender-config-env
name: adfsender-config
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: adfsender-config-env
name: adfsender-config
namespace: sendernm
data:
env.sh: |-
Expand Down
2 changes: 1 addition & 1 deletion channel-sender/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defmodule ChannelSenderEx.MixProject do
def project do
[
app: :channel_sender_ex,
version: "0.1.3",
version: "0.1.4",
elixir: "~> 1.12",
start_permanent: Mix.env() == :prod,
deps: deps(),
Expand Down

0 comments on commit 8a87c39

Please sign in to comment.