mirror of
https://github.com/valitydev/token-keeper.git
synced 2024-11-06 02:15:21 +00:00
TD-222: Sync Dockerfiles w/ valitydev/erlang-templates (#25)
* Switch to valitydev/action-deploy-docker@v2
This commit is contained in:
parent
f5289375b8
commit
8cc0d3036c
2
.github/workflows/build-image.yml
vendored
2
.github/workflows/build-image.yml
vendored
@ -15,7 +15,7 @@ jobs:
|
|||||||
build-push:
|
build-push:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: valitydev/action-deploy-docker@634e37d1a5367a0d3029a271b1112f22ce891d23
|
- uses: valitydev/action-deploy-docker@v2
|
||||||
with:
|
with:
|
||||||
registry-username: ${{ github.actor }}
|
registry-username: ${{ github.actor }}
|
||||||
registry-access-token: ${{ secrets.GITHUB_TOKEN }}
|
registry-access-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
19
Dockerfile
19
Dockerfile
@ -2,13 +2,12 @@ ARG OTP_VERSION
|
|||||||
|
|
||||||
# Build the release
|
# Build the release
|
||||||
FROM docker.io/library/erlang:${OTP_VERSION} AS builder
|
FROM docker.io/library/erlang:${OTP_VERSION} AS builder
|
||||||
|
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
||||||
ARG BUILDARCH
|
|
||||||
|
|
||||||
# Install thrift compiler
|
# Install thrift compiler
|
||||||
ARG THRIFT_VERSION
|
ARG THRIFT_VERSION
|
||||||
|
ARG TARGETARCH
|
||||||
RUN wget -q -O- "https://github.com/valitydev/thrift/releases/download/${THRIFT_VERSION}/thrift-${THRIFT_VERSION}-linux-${BUILDARCH}.tar.gz" \
|
RUN wget -q -O- "https://github.com/valitydev/thrift/releases/download/${THRIFT_VERSION}/thrift-${THRIFT_VERSION}-linux-${TARGETARCH}.tar.gz" \
|
||||||
| tar -xvz -C /usr/local/bin/
|
| tar -xvz -C /usr/local/bin/
|
||||||
|
|
||||||
# Copy sources
|
# Copy sources
|
||||||
@ -17,8 +16,8 @@ COPY . /build/
|
|||||||
|
|
||||||
# Build the release
|
# Build the release
|
||||||
WORKDIR /build
|
WORKDIR /build
|
||||||
RUN rebar3 compile
|
RUN rebar3 compile && \
|
||||||
RUN rebar3 as prod release
|
rebar3 as prod release
|
||||||
|
|
||||||
# Make a runner image
|
# Make a runner image
|
||||||
FROM docker.io/library/erlang:${OTP_VERSION}-slim
|
FROM docker.io/library/erlang:${OTP_VERSION}-slim
|
||||||
@ -29,15 +28,15 @@ ARG SERVICE_NAME
|
|||||||
ENV CHARSET=UTF-8
|
ENV CHARSET=UTF-8
|
||||||
ENV LANG=C.UTF-8
|
ENV LANG=C.UTF-8
|
||||||
|
|
||||||
# Expose SERVICE_NAME as env so CMD expands properly on start
|
|
||||||
ENV SERVICE_NAME=${SERVICE_NAME}
|
|
||||||
|
|
||||||
# Set runtime
|
# Set runtime
|
||||||
WORKDIR /opt/${SERVICE_NAME}
|
WORKDIR /opt/${SERVICE_NAME}
|
||||||
|
|
||||||
COPY --from=builder /build/_build/prod/rel/${SERVICE_NAME} /opt/${SERVICE_NAME}
|
COPY --from=builder /build/_build/prod/rel/${SERVICE_NAME} /opt/${SERVICE_NAME}
|
||||||
|
|
||||||
|
RUN echo "#!/bin/sh" >> /entrypoint.sh && \
|
||||||
|
echo "exec /opt/${SERVICE_NAME}/bin/${SERVICE_NAME} foreground" >> /entrypoint.sh && \
|
||||||
|
chmod +x /entrypoint.sh
|
||||||
ENTRYPOINT []
|
ENTRYPOINT []
|
||||||
CMD /opt/${SERVICE_NAME}/bin/${SERVICE_NAME} foreground
|
CMD ["/entrypoint.sh"]
|
||||||
|
|
||||||
EXPOSE 8022
|
EXPOSE 8022
|
||||||
|
@ -1,13 +1,12 @@
|
|||||||
ARG OTP_VERSION
|
ARG OTP_VERSION
|
||||||
|
|
||||||
FROM docker.io/library/erlang:${OTP_VERSION}
|
FROM docker.io/library/erlang:${OTP_VERSION}
|
||||||
|
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
||||||
ARG BUILDARCH
|
|
||||||
|
|
||||||
# Install thrift compiler
|
# Install thrift compiler
|
||||||
ARG THRIFT_VERSION
|
ARG THRIFT_VERSION
|
||||||
|
ARG TARGETARCH
|
||||||
RUN wget -q -O- "https://github.com/valitydev/thrift/releases/download/${THRIFT_VERSION}/thrift-${THRIFT_VERSION}-linux-${BUILDARCH}.tar.gz" \
|
RUN wget -q -O- "https://github.com/valitydev/thrift/releases/download/${THRIFT_VERSION}/thrift-${THRIFT_VERSION}-linux-${TARGETARCH}.tar.gz" \
|
||||||
| tar -xvz -C /usr/local/bin/
|
| tar -xvz -C /usr/local/bin/
|
||||||
|
|
||||||
# Set env
|
# Set env
|
||||||
@ -15,4 +14,4 @@ ENV CHARSET=UTF-8
|
|||||||
ENV LANG=C.UTF-8
|
ENV LANG=C.UTF-8
|
||||||
|
|
||||||
# Set runtime
|
# Set runtime
|
||||||
CMD /bin/bash
|
CMD ["/bin/bash"]
|
||||||
|
Loading…
Reference in New Issue
Block a user