Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Docker Build #189

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Builds the Web Client from the latest git repo

# Two stages are used to reduce complexity and final image size. The first stage builds the actual
# client. The second stage runs the web client using an nginx server, using the nginx
# configurations in this folder as well as the built files from the previous stage.

# Build Stage =====================================================================================

# Use node image for build step (this has yarn which we need)
FROM node:alpine as build

# This variable allows you to set the default etesync server for the web client.
# Change this to your own server if self hosting.
ENV REACT_APP_DEFAULT_API_PATH "https://api.etebase.com/partner/etesync/"

# Clones the latest web client code from git and builds the client and its dependencies with yarn
RUN apk add --no-cache git && \
git clone https://github.com/etesync/etesync-web.git etesync-web && \
cd etesync-web && \
yarn && \
yarn build

# Run Stage =======================================================================================

# This lightweight image contains nginx which will run the web client
FROM nginx:alpine

# Grabs the built web client files from the previous build stage
COPY --from=build /etesync-web/build /usr/share/nginx/html

# Copies the nginx configuration from this folder to the running container
COPY ./nginx.conf /etc/nginx/conf.d/default.conf

# Exposes port 80, the port nginx is configured to listen on
EXPOSE 80
17 changes: 17 additions & 0 deletions docker/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
server {

listen 80 default_server;
listen [::]:80 default_server;
charset utf-8;
client_max_body_size 75M; # max upload size
location / {
root /usr/share/nginx/html;
try_files $uri $uri/ /index.html =404;
autoindex on;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
EOF