diff --git a/channel-sender/Dockerfile b/channel-sender/Dockerfile index 88d95f2..4ab47cd 100644 --- a/channel-sender/Dockerfile +++ b/channel-sender/Dockerfile @@ -4,7 +4,6 @@ FROM elixir:1.12-alpine as build ARG BUILD_ENV=prod -ARG BUILD_VER=0.1.3 WORKDIR /build @@ -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 \ @@ -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"] diff --git a/channel-sender/deploy_samples/k8s/libcluster-kubernetes-dns/app.yaml b/channel-sender/deploy_samples/k8s/libcluster-kubernetes-dns/app.yaml index 62373bd..020b9a9 100644 --- a/channel-sender/deploy_samples/k8s/libcluster-kubernetes-dns/app.yaml +++ b/channel-sender/deploy_samples/k8s/libcluster-kubernetes-dns/app.yaml @@ -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: @@ -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 diff --git a/channel-sender/deploy_samples/k8s/libcluster-kubernetes-dnssrv/app.yaml b/channel-sender/deploy_samples/k8s/libcluster-kubernetes-dnssrv/app.yaml index f658e11..54131ee 100644 --- a/channel-sender/deploy_samples/k8s/libcluster-kubernetes-dnssrv/app.yaml +++ b/channel-sender/deploy_samples/k8s/libcluster-kubernetes-dnssrv/app.yaml @@ -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" @@ -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 diff --git a/channel-sender/deploy_samples/k8s/libcluster-kubernetes/app.yaml b/channel-sender/deploy_samples/k8s/libcluster-kubernetes/app.yaml index 7f75ecb..61058ef 100644 --- a/channel-sender/deploy_samples/k8s/libcluster-kubernetes/app.yaml +++ b/channel-sender/deploy_samples/k8s/libcluster-kubernetes/app.yaml @@ -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: @@ -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 \ No newline at end of file + name: adfsender-config \ No newline at end of file diff --git a/channel-sender/deploy_samples/k8s/libcluster-kubernetes/configmap.yaml b/channel-sender/deploy_samples/k8s/libcluster-kubernetes/configmap.yaml index 388b8fd..649d7cb 100644 --- a/channel-sender/deploy_samples/k8s/libcluster-kubernetes/configmap.yaml +++ b/channel-sender/deploy_samples/k8s/libcluster-kubernetes/configmap.yaml @@ -1,7 +1,7 @@ apiVersion: v1 kind: ConfigMap metadata: - name: adfsender-config-env + name: adfsender-config namespace: sendernm data: env.sh: |- diff --git a/channel-sender/mix.exs b/channel-sender/mix.exs index 047a612..bc1c19f 100644 --- a/channel-sender/mix.exs +++ b/channel-sender/mix.exs @@ -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(),