Skip to content

Commit c51e488

Browse files
committed
removed frontend
1 parent e8430ac commit c51e488

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+171
-8943
lines changed

.dockerignore

Lines changed: 45 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,45 @@
1-
_build
2-
deps
3-
frontend/node_modules
4-
frontend/.next
5-
frontend/out
1+
# This file excludes paths from the Docker build context.
2+
#
3+
# By default, Docker's build context includes all files (and folders) in the
4+
# current directory. Even if a file isn't copied into the container it is still sent to
5+
# the Docker daemon.
6+
#
7+
# There are multiple reasons to exclude files from the build context:
8+
#
9+
# 1. Prevent nested folders from being copied into the container (ex: exclude
10+
# /assets/node_modules when copying /assets)
11+
# 2. Reduce the size of the build context and improve build time (ex. /build, /deps, /doc)
12+
# 3. Avoid sending files containing sensitive information
13+
#
14+
# More information on using .dockerignore is available here:
15+
# https://docs.docker.com/engine/reference/builder/#dockerignore-file
16+
17+
.dockerignore
18+
19+
# Ignore git, but keep git HEAD and refs to access current commit hash if needed:
20+
#
21+
# $ cat .git/HEAD | awk '{print ".git/"$2}' | xargs cat
22+
# d0b8727759e1e0e7aa3d41707d12376e373d5ecc
23+
.git
24+
!.git/HEAD
25+
!.git/refs
26+
27+
# Common development/test artifacts
28+
/cover/
29+
/doc/
30+
/test/
31+
/tmp/
32+
.elixir_ls
33+
34+
# Mix artifacts
35+
/_build/
36+
/deps/
37+
*.ez
38+
39+
# Generated on crash by the VM
40+
erl_crash.dump
41+
42+
# Static artifacts - These should be fetched and built inside the Docker image
43+
/assets/node_modules/
44+
/priv/static/assets/
45+
/priv/static/cache_manifest.json

Caddyfile

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,4 @@ vsekai.local {
66
handle /uploads/* {
77
reverse_proxy uro:4000
88
}
9-
10-
handle_path /* {
11-
reverse_proxy nextjs:3000
12-
}
139
}

Dockerfile

Lines changed: 84 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,97 @@
1-
ARG ELIXIR_VERSION=1.17
1+
# Find eligible builder and runner images on Docker Hub. We use Ubuntu/Debian
2+
# instead of Alpine to avoid DNS resolution issues in production.
3+
#
4+
# https://hub.docker.com/r/hexpm/elixir/tags?page=1&name=ubuntu
5+
# https://hub.docker.com/_/ubuntu?tab=tags
6+
#
7+
# This file is based on these images:
8+
#
9+
# - https://hub.docker.com/r/hexpm/elixir/tags - for the build image
10+
# - https://hub.docker.com/_/debian?tab=tags&page=1&name=bullseye-20241202-slim - for the release image
11+
# - https://pkgs.org/ - resource for finding needed packages
12+
# - Ex: hexpm/elixir:1.17.3-erlang-25.3.2.15-debian-bullseye-20241202-slim
13+
#
14+
ARG ELIXIR_VERSION=1.17.3
15+
ARG OTP_VERSION=25.3.2.15
16+
ARG DEBIAN_VERSION=bullseye-20241202-slim
217

3-
# Elixir build environment.
4-
FROM elixir:${ELIXIR_VERSION}-alpine as elixir-base
18+
ARG BUILDER_IMAGE="hexpm/elixir:${ELIXIR_VERSION}-erlang-${OTP_VERSION}-debian-${DEBIAN_VERSION}"
19+
ARG RUNNER_IMAGE="debian:${DEBIAN_VERSION}"
520

6-
ARG MIX_ENV=prod
21+
FROM ${BUILDER_IMAGE} as builder
722

8-
ENV MIX_ENV=${MIX_ENV} \
9-
COMPILE_PHASE=true
23+
# install build dependencies
24+
RUN apt-get update -y && apt-get install -y build-essential git \
25+
&& apt-get clean && rm -f /var/lib/apt/lists/*_*
1026

27+
# prepare build dir
1128
WORKDIR /app
1229

13-
RUN apk add --no-cache \
14-
nodejs \
15-
npm \
16-
inotify-tools \
17-
git \
18-
bash \
19-
make \
20-
gcc \
21-
curl \
22-
libc-dev
23-
30+
# install hex + rebar
2431
RUN mix local.hex --force && \
25-
mix local.rebar --force
32+
mix local.rebar --force
33+
34+
# set build ENV
35+
ENV MIX_ENV="prod"
2636

37+
# install mix dependencies
2738
COPY mix.exs mix.lock ./
28-
RUN mix do deps.get, patch.exmarcel, deps.compile
39+
RUN mix deps.get --only $MIX_ENV
40+
RUN mkdir config
41+
42+
# copy compile-time config files before we compile dependencies
43+
# to ensure any relevant config change will trigger the dependencies
44+
# to be re-compiled.
45+
COPY config/config.exs config/${MIX_ENV}.exs config/
46+
RUN mix deps.compile
47+
48+
COPY priv priv
49+
50+
COPY lib lib
51+
52+
COPY assets assets
53+
54+
# compile assets
55+
RUN mix assets.deploy
56+
57+
# Compile the release
58+
RUN mix compile
59+
60+
# Changes to config/runtime.exs don't require recompiling the code
61+
COPY config/runtime.exs config/
62+
63+
COPY rel rel
64+
RUN mix release
65+
66+
# start a new build stage so that the final image will only contain
67+
# the compiled release and other runtime necessities
68+
FROM ${RUNNER_IMAGE}
69+
70+
RUN apt-get update -y && \
71+
apt-get install -y libstdc++6 openssl libncurses5 locales ca-certificates \
72+
&& apt-get clean && rm -f /var/lib/apt/lists/*_*
73+
74+
# Set the locale
75+
RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && locale-gen
76+
77+
ENV LANG en_US.UTF-8
78+
ENV LANGUAGE en_US:en
79+
ENV LC_ALL en_US.UTF-8
80+
81+
WORKDIR "/app"
82+
RUN chown nobody /app
83+
84+
# set runner ENV
85+
ENV MIX_ENV="prod"
2986

30-
COPY config ./config
31-
COPY priv ./priv
32-
COPY lib ./lib
87+
# Only copy the final release from the build stage
88+
COPY --from=builder --chown=nobody:root /app/_build/${MIX_ENV}/rel/uro ./
3389

34-
RUN mix do compile, phx.digest
35-
RUN mix uro.apigen
90+
USER nobody
3691

37-
EXPOSE ${PORT}
92+
# If using an environment that doesn't automatically reap zombie processes, it is
93+
# advised to add an init process such as tini via `apt-get install`
94+
# above and adding an entrypoint. See https://github.com/krallin/tini for details
95+
# ENTRYPOINT ["/tini", "--"]
3896

39-
ENV COMPILE_PHASE=false
40-
ENTRYPOINT iex -S mix do ecto.migrate, phx.server
97+
CMD ["/app/bin/server"]

docker-compose.development.yml

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
version: "3.9"
21
services:
32
uro:
43
extends:
@@ -12,18 +11,6 @@ services:
1211
- ./config:/app/config
1312
- ./priv:/app/priv
1413

15-
nextjs:
16-
extends:
17-
file: docker-compose.yml
18-
service: nextjs
19-
build:
20-
args:
21-
NODE_ENV: development
22-
entrypoint: npm run dev
23-
user: "root"
24-
volumes:
25-
- ./frontend:/app
26-
2714
database:
2815
extends:
2916
file: docker-compose.yml
@@ -45,4 +32,4 @@ networks:
4532

4633
volumes:
4734
caddy_data:
48-
caddy_config:
35+
caddy_config:

docker-compose.yml

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -69,20 +69,6 @@ services:
6969
# test: curl --fail http://uro:4000/health || exit 1
7070
# interval: 5s
7171
# timeout: 5s
72-
73-
nextjs:
74-
build:
75-
context: ./frontend
76-
dockerfile: Dockerfile
77-
env_file:
78-
- frontend/.env
79-
# healthcheck:
80-
# test: curl --fail http://nextjs:3000/health || exit 1
81-
# interval: 5s
82-
# timeout: 5s
83-
depends_on:
84-
- uro
85-
8672
caddy:
8773
image: caddy:2.9.1-alpine
8874
restart: unless-stopped
@@ -98,13 +84,6 @@ services:
9884
- ./caddy/config:/config
9985
depends_on:
10086
- uro
101-
- nextjs
102-
# uro:
103-
# condition: service_healthy
104-
# restart: true
105-
# nextjs:
106-
# condition: service_healthy
107-
# restart: true
10887

10988
networks:
11089
uro:

frontend/.dockerignore

Lines changed: 0 additions & 3 deletions
This file was deleted.

frontend/.env.example

Lines changed: 0 additions & 8 deletions
This file was deleted.

frontend/.gitignore

Lines changed: 0 additions & 42 deletions
This file was deleted.

frontend/Dockerfile

Lines changed: 0 additions & 60 deletions
This file was deleted.

0 commit comments

Comments
 (0)