Skip to content

Commit

Permalink
update to latest alpine image
Browse files Browse the repository at this point in the history
  • Loading branch information
ilude committed May 5, 2023
1 parent 536a4b5 commit 880d29f
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 19 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.vscode/
*.log
59 changes: 44 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM ruby:3.0.2-alpine3.14
# syntax=docker/dockerfile:1.3-labs
FROM ruby:3-alpine as base

LABEL maintainer="Mike Glenn <[email protected]>"
LABEL ilude-project=joyride
Expand All @@ -9,32 +10,60 @@ RUN \
echo 'install: --no-document'; \
echo 'update: --no-document'; \
} >> /usr/local/etc/gemrc \
&& apk add --no-cache \
bash \
dnsmasq \
tzdata \
htop \
&& update-ca-certificates \
&& ln -snf /etc/localtime /usr/share/zoneinfo/$TZ && echo $TZ > /etc/timezone \
&& apk add --no-cache bash shadow tzdata \
&& rm -rf \
/usr/lib/ruby/gems/*/cache/* \
/root/.gem/ \
/var/cache/apk/* \
/tmp/* \
/var/tmp/*

WORKDIR /app
ARG USER=anvil
ENV USER=${USER}
ARG PUID=1000
ARG PGID=1000
ENV APP /app
ENV GEM_HOME /gems

COPY ./app/Gemfile /app/Gemfile
RUN bundle install
RUN \
groupadd -g $PGID $USER && \
useradd -s /sbin/nologin -g $PGID -u $PUID -d /home/$USER $USER && \
mkdir -p /home/anvil && \
chown $USER:$USER $APP

WORKDIR $APP

COPY *-entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/*-entrypoint.sh
COPY --chmod=755 <<-"EOF" /usr/local/bin/docker-entrypoint.sh
#!/bin/sh
set -e

COPY ./app /app
exec $@
EOF

EXPOSE 54/udp

ENTRYPOINT ["docker-entrypoint.sh"]
CMD [ "bundle", "exec", "ruby", "joyride.rb" ]


##############################
# Begin builder
##############################
FROM base AS builder

RUN apk --no-cache add \
build-base \
git

COPY ./app/Gemfile $APP
#COPY ./app/Gemfile.lock $APP
RUN bundle install

##############################
# Begin production
##############################
FROM base AS production

COPY --from=builder ${GEM_HOME} ${GEM_HOME}
COPY ./app $APP

USER $USER
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ services:
build:
context: .
dockerfile: Dockerfile
target: ${ENV_CONTEXT:-production}
image: ilude/joyride
container_name: joyride
restart: unless-stopped
Expand Down
4 changes: 0 additions & 4 deletions docker-entrypoint.sh

This file was deleted.

0 comments on commit 880d29f

Please sign in to comment.