mirror of
https://github.com/benbusby/farside.git
synced 2025-06-08 02:16:36 +00:00
add deploy to heroku
This commit is contained in:
parent
7bd91cbcad
commit
d69b859910
4 changed files with 91 additions and 0 deletions
73
Dockerfile
Normal file
73
Dockerfile
Normal file
|
@ -0,0 +1,73 @@
|
||||||
|
# https://cloud.google.com/community/tutorials/elixir-phoenix-on-kubernetes-google-container-engine
|
||||||
|
# Build time container
|
||||||
|
ARG ALPINE_VERSION=3.15
|
||||||
|
|
||||||
|
FROM elixir:1.13.3-alpine AS builder
|
||||||
|
|
||||||
|
ARG app_name=farside
|
||||||
|
ARG subdir=.
|
||||||
|
ARG build_env=prod
|
||||||
|
ARG SOURCE_VERSION
|
||||||
|
ARG COMMIT=${SOURCE_VERSION}
|
||||||
|
ARG MIX_ENV=prod
|
||||||
|
|
||||||
|
ENV APP_NAME=${app_name} \
|
||||||
|
MIX_ENV=${MIX_ENV} \
|
||||||
|
COMMIT=${COMMIT}
|
||||||
|
|
||||||
|
ENV REPLACE_OS_VARS=true
|
||||||
|
ENV MIX_ENV=${build_env} TERM=xterm
|
||||||
|
|
||||||
|
RUN set -ex && \
|
||||||
|
apk update && \
|
||||||
|
apk upgrade --no-cache && \
|
||||||
|
apk add --no-cache \
|
||||||
|
git \
|
||||||
|
curl \
|
||||||
|
nodejs \
|
||||||
|
npm \
|
||||||
|
python3 \
|
||||||
|
build-base && \
|
||||||
|
mix local.rebar --force && \
|
||||||
|
mix local.hex --force && \
|
||||||
|
mkdir -p /opt/built
|
||||||
|
|
||||||
|
RUN mkdir /app
|
||||||
|
COPY . /app
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
RUN mix do deps.get, compile
|
||||||
|
RUN cd ${subdir}/assets \
|
||||||
|
&& npm install \
|
||||||
|
&& npm run deploy \
|
||||||
|
&& cd .. \
|
||||||
|
RUN mix release ${app_name} \
|
||||||
|
&& mv _build/${build_env}/rel/${app_name} /opt/release \
|
||||||
|
&& mv /opt/release/bin/${app_name} /opt/release/bin/server
|
||||||
|
|
||||||
|
# Runtime container
|
||||||
|
FROM alpine:${ALPINE_VERSION}est
|
||||||
|
|
||||||
|
RUN set -ex && \
|
||||||
|
apk update && \
|
||||||
|
apk add --no-cache \
|
||||||
|
bash \
|
||||||
|
curl \
|
||||||
|
gcc \
|
||||||
|
nodejs-current \
|
||||||
|
libstdc++ \
|
||||||
|
openssl-dev && \
|
||||||
|
curl https://raw.githubusercontent.com/eficode/wait-for/f71f8199a0dd95953752fb5d3f76f79ced16d47d/wait-for -o /usr/local/bin/wait-for && \
|
||||||
|
chmod +x /usr/local/bin/wait-for
|
||||||
|
|
||||||
|
# For local dev, heroku will ignore this
|
||||||
|
EXPOSE $PORT
|
||||||
|
|
||||||
|
WORKDIR /opt/app
|
||||||
|
COPY --from=0 /opt/release .
|
||||||
|
RUN addgroup -S elixir && adduser -H -D -S -G elixir elixir
|
||||||
|
RUN chown -R elixir:elixir /opt/app
|
||||||
|
USER elixir
|
||||||
|
|
||||||
|
# Heroku sets magical $PORT variable
|
||||||
|
CMD PORT=$PORT
|
|
@ -3,6 +3,7 @@
|
||||||
[](https://github.com/benbusby/farside/releases)
|
[](https://github.com/benbusby/farside/releases)
|
||||||
[](http://opensource.org/licenses/MIT)
|
[](http://opensource.org/licenses/MIT)
|
||||||
[](https://github.com/benbusby/privacy-revolver/actions/workflows/elixir.yml)
|
[](https://github.com/benbusby/privacy-revolver/actions/workflows/elixir.yml)
|
||||||
|
[](https://heroku.com/deploy)
|
||||||
|
|
||||||
A redirecting service for FOSS alternative frontends.
|
A redirecting service for FOSS alternative frontends.
|
||||||
|
|
||||||
|
|
13
app.json
Normal file
13
app.json
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
{
|
||||||
|
"name": "Farside",
|
||||||
|
"description": "A redirecting service for FOSS alternative frontends",
|
||||||
|
"repository": "https://github.com/data-twister/farside",
|
||||||
|
"logo": "",
|
||||||
|
"keywords": ["elixir", "farside" ],
|
||||||
|
"addons": [ "heroku-postgresql"],
|
||||||
|
"buildpacks": [
|
||||||
|
{
|
||||||
|
"url": "https://github.com/HashNuke/heroku-buildpack-elixir.git"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
4
elixir_buildpack.config
Normal file
4
elixir_buildpack.config
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
|
||||||
|
elixir_version=1.12.3
|
||||||
|
erlang_version=24.2.1
|
||||||
|
clean_cache=true
|
Loading…
Add table
Add a link
Reference in a new issue