Skip to content

Commit cd7651f

Browse files
authored
Merge pull request #348 from TaloDev/caddy
Use caddy instead of nginx for Docker image
2 parents a6685d1 + 58c672c commit cd7651f

File tree

5 files changed

+23
-20
lines changed

5 files changed

+23
-20
lines changed

.env.production

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
VITE_API_URL=${API_URL}
1+
VITE_API_URL={{API_URL}}
22

3-
VITE_SENTRY_DSN=${SENTRY_DSN}
3+
VITE_SENTRY_DSN={{SENTRY_DSN}}
44
VITE_SENTRY_ENV=prod

Dockerfile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ RUN sed -i 's/\${/\\${/g' .env.production
99
RUN npm install
1010
RUN npm run build
1111

12-
FROM nginx:stable-alpine
13-
COPY --from=build /usr/frontend/dist /bin/www
14-
COPY /config/nginx.conf /etc/nginx/conf.d/default.conf
15-
COPY --from=build /usr/frontend/config/entrypoint.sh /bin
12+
FROM caddy:2-alpine
13+
COPY --from=build /usr/frontend/dist /srv
14+
COPY /config/Caddyfile /etc/caddy/Caddyfile
15+
COPY --from=build /usr/frontend/config/entrypoint.sh /usr/local/bin/
1616

1717
RUN apk add --no-cache nodejs npm
1818
RUN npm i envsub -g
19-
RUN chmod +x /bin/entrypoint.sh
19+
RUN chmod +x /usr/local/bin/entrypoint.sh
2020

21-
ENTRYPOINT ["/bin/entrypoint.sh"]
21+
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
2222

2323
EXPOSE 80

config/Caddyfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
:80 {
2+
root * /srv
3+
encode gzip
4+
5+
try_files {path} /index.html
6+
file_server
7+
8+
handle_errors {
9+
rewrite * /index.html
10+
file_server
11+
}
12+
}

config/entrypoint.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/sh
2-
for filename in /bin/www/assets/*.js; do
3-
envsub $filename $filename
2+
for filename in /srv/assets/*.js; do
3+
envsub --syntax handlebars $filename $filename
44
done
55

6-
nginx -g 'daemon off;'
6+
caddy run --config /etc/caddy/Caddyfile

config/nginx.conf

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

0 commit comments

Comments
 (0)