-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from alpacanetworks/13-add-dockerfile
Add dockerfile to build project
- Loading branch information
Showing
1 changed file
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Build: docker build -t alpacon-server . | ||
# Run: docker run --env-file .docker/env -p 8000:8000 alpacon-server --restart unless-stopped | ||
|
||
FROM node:slim AS builder | ||
|
||
WORKDIR /root | ||
|
||
COPY package.json ./ | ||
|
||
RUN npm install | ||
|
||
FROM python:3.11-slim-bullseye | ||
|
||
ARG DEBIAN_FRONTEND=noninteractive | ||
|
||
RUN apt-get update && apt-get install -y --no-install-recommends gcc gettext libffi-dev libpq-dev libssl-dev libldap2-dev libsasl2-dev | ||
RUN addgroup --system --gid 200 alpacon && adduser --system --uid 200 --gid 200 --home /var/lib/alpacon --shell /bin/bash --disabled-password --disabled-login alpacon | ||
|
||
WORKDIR /opt/alpacon | ||
|
||
COPY --from=builder /root/node_modules ./ | ||
COPY . . | ||
|
||
RUN pip install --no-cache-dir -r requirements.txt && django-admin compilemessages --ignore env | ||
RUN mkdir /opt/alpacon/media && chown -R alpacon:alpacon /opt/alpacon/media | ||
|
||
USER alpacon | ||
|
||
ENV PATH=/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/var/lib/alpacon/.local/bin | ||
|
||
EXPOSE 8000 | ||
|
||
CMD ["gunicorn", "--bind", ":8000", "--workers", "3", "alpacon.wsgi:application"] |